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
CSC509 Lecture 08
javiergs
PRO
0
110
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
880
Tuning GraphQL on Rails
pyama86
2
1k
WEBエンジニア向けAI活用入門
sutetotanuki
0
300
C#/.NETのこれまでのふりかえり
tomokusaba
1
160
Why Spring Matters to Jakarta EE - and Vice Versa
ivargrimstad
0
1k
qmuntal/stateless のススメ
sgash708
0
120
VR HMDとしてのVision Pro+ゲーム開発について
yasei_no_otoko
0
100
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.6k
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
Featured
See All Featured
A better future with KSS
kneath
238
17k
Building Applications with DynamoDB
mza
90
6.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
107
49k
Designing for Performance
lara
604
68k
Ruby is Unlike a Banana
tanoku
96
11k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
Thoughts on Productivity
jonyablonski
67
4.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
290
For a Future-Friendly Web
brad_frost
175
9.4k
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