Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SVG Reality
Search
Sebastiaan Deckers
November 19, 2014
Programming
5
140
SVG Reality
Talk at CSSConf.asia 2014
http://2014.cssconf.asia/
Sebastiaan Deckers
November 19, 2014
Tweet
Share
More Decks by Sebastiaan Deckers
See All by Sebastiaan Deckers
Commons Host: Building a CDN for the rest of the world
sebdeckers
1
130
About Sebastiaan
sebdeckers
0
140
Frontend 100
sebdeckers
1
480
Frontend 101
sebdeckers
4
540
Frontend 102
sebdeckers
3
490
Frontend 103
sebdeckers
2
480
Frontend Testing
sebdeckers
3
330
Grunt: The JavaScript Task Runner
sebdeckers
8
400
Other Decks in Programming
See All in Programming
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
240
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
Ethereum_.pdf
nekomatu
0
470
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
最新TCAキャッチアップ
0si43
0
200
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1k
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
React への依存を最小にするフロントエンド設計
takonda
3
530
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Visualization
eitanlees
145
15k
Site-Speed That Sticks
csswizardry
0
29
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Optimizing for Happiness
mojombo
376
70k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Designing for Performance
lara
604
68k
Writing Fast Ruby
sferik
627
61k
Docker and Python
trallard
40
3.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Transcript
REALITY SVG REALITY SVG SVG REALITY
1024×768 1024×768 1024×768
OMG×FML OMG×FML OMG×FML
FIT FIT FIT
HiDPI HiDPI HiDPI
LoDPI LoDPI LoDPI
STRETCH STRETCH STRETCH
ONE DIV?! ONE DIV?! ONE DIV?!
RUBE GOLDBERG CSS RUBE GOLDBERG CSS RUBE GOLDBERG CSS
SCALABLE VECTOR GRAPHICS SCALABLE VECTOR GRAPHICS SCALABLE VECTOR GRAPHICS
None
SEBASTIAAN DECKERS SEBASTIAAN DECKERS SEBASTIAAN DECKERS FRONT END DEVELOPER AT
COFOUNDERS.SG FRONT END DEVELOPER AT COFOUNDERS.SG FRONT END DEVELOPER AT COFOUNDERS.SG
FRONT END DEVS SG FRONT END DEVS SG FRONT END
DEVS SG
SVG vs CSS SVG vs CSS SVG vs CSS HiDPI
Animations Hardware Acceleration Blending Modes Responsive Media Queries Debugging Inspector Filters DOM API Scripting Colour Profiles
USAGE USAGE USAGE
Native support for inline <svg/>
CSS url(image.svg)
SVG FONTS DEPRECATED COMEBACK? SVG FONTS DEPRECATED COMEBACK? SVG FONTS
DEPRECATED COMEBACK?
SVG FRAGMENTS SVG FRAGMENTS SVG FRAGMENTS
USAGE SVG Building Blocks SVG Building Blocks SVG Building Blocks
= CSS 2.1 UNITS = CSS 2.1 UNITS UNITS =
CSS 2.1
BASIC SHAPES
Paths <path> Text based drawing instructions for line, arc, bezier
curve, quadratic curve, etc. Use an editor! Inkscape, Sketch, Illustrator
Embedded images <image> with xlink:href="foobar.{png,jpeg, gif,webp,svg}" or Base64 encoded
And more... Groups, Patterns, Transformations, References, ...
SVG DOM SVG DOM SVG DOM
XMLNS XMLNS XMLNS svgns = “http://www.w3.org/2000/svg” document.createElementNS(svgns, …) document.setAttributeNS document.getElementsByTagNameNS
API WRAPPERS API WRAPPERS API WRAPPERS
WEB COMPONENTS WEB COMPONENTS WEB COMPONENTS document.registerElement('my-shape', { extends: 'circle',
prototype: Object.create( SVGCircleElement.prototype, {/*...*/} ) })
CSS & SVG CSS & SVG CSS & SVG
INLINE IN SVG CASCADING IN SVG CASCADING IN HTML EXTERNAL
FROM SVG INLINE IN SVG CASCADING IN SVG CASCADING IN HTML EXTERNAL FROM SVG
Tips & Tricks Tips & Tricks Tips & Tricks
viewBox min-x min-y width height
preserveAspectRatio preserveAspectRatio POOR MAN’S BG-SIZE preserveAspectRatio X/Y min/mid/max, slice/keep X/Y
min/mid/max, slice/keep X/Y min/mid/max, slice/keep POOR MAN’S BG-SIZE POOR MAN’S BG-SIZE
None
MAX SIZE MAX SIZE MAX SIZE Infinite resolution, but Maximum
±5 megapixels
SVGOptimizer SVGOptimizer SVGOptimizer also as {grunt,gulp}-svgmin also as {grunt,gulp}-svgmin also
as {grunt,gulp}-svgmin
BUT WAIT... BUT WAIT... BUT WAIT...
ANIMATION SMIL & JS ANIMATION SMIL & JS ANIMATION SMIL
& JS
SVG 1.2 SVG 2 SVG 1.2 SVG 2 SVG 1.2
SVG 2
THANK YOU THANK YOU THANK YOU