svg strikes back

88
SVG STRIKES BACK Matt Baxter • @mbxtr • October 7, 2014

Upload: matt-baxter

Post on 19-Dec-2014

155 views

Category:

Software


6 download

DESCRIPTION

SVG was first introduced on the web in 2001 and finally came around to being a practical web technology in 2011. Thanks to wide browser support and the popularity of retina screens, SVG is a powerful and flexible technology that everyone should have in their web development toolbox. In this talk, I'll tell you why should be using SVGs now and how to integrate SVGs into responsive websites, use it in iconography for resolution independence, and use JavaScript and CSS to create animations and interactive prototypes. I gave this talk at Front Porch in Dallas, TX on October 7th. http://frontporch.io/

TRANSCRIPT

Page 1: SVG Strikes Back

SVGST R I K E S B AC K

Matt Baxter • @mbxtr • October 7, 2014

Page 2: SVG Strikes Back

Matt Baxter @mbxtr

Page 3: SVG Strikes Back
Page 4: SVG Strikes Back

UX Designer Design + Code

Page 5: SVG Strikes Back

SV-WHAT?

Page 6: SVG Strikes Back

Scalable Vector Graphics

Page 7: SVG Strikes Back

So Very Good

Page 8: SVG Strikes Back

SVGis an open graphics standard, made for the web, based on XML.

Page 9: SVG Strikes Back

SVGis for any illustrated image.

Page 10: SVG Strikes Back

Logos

Page 11: SVG Strikes Back

Logos

Page 12: SVG Strikes Back

Icons

Page 13: SVG Strikes Back

Icons

Page 14: SVG Strikes Back

LOLcats

Page 15: SVG Strikes Back

LOLcats

Page 16: SVG Strikes Back

Scalability

Vector Raster

Page 17: SVG Strikes Back

Vector Raster

Scalability

Page 18: SVG Strikes Back

File Size

SVG (2kb) PNG (88kb)512x512

Page 19: SVG Strikes Back

True resolution independence

Page 20: SVG Strikes Back

Responsive design is more than just

mobile/tablet/desktop

a

Page 21: SVG Strikes Back

SVG is Old(in web years, anyways)

Page 22: SVG Strikes Back

1.0 Recommendation

…back in 2001

Page 23: SVG Strikes Back

Where has it been for 13 years?

Page 24: SVG Strikes Back

2001 2006

2005

2011

Page 25: SVG Strikes Back

The need for resolution-independent images is

greater than ever.

Page 26: SVG Strikes Back

Screens in 2001

http://www.nngroup.com/articles/computer-screens-getting-bigger/

65% 800x600

30% 1024x768

Page 27: SVG Strikes Back

Screens in 2014

http://www.html5rocks.com/en/tutorials/tooling/synchronized-cross-device-testing/

Page 28: SVG Strikes Back

Pixel density in 2001

1x

(standard monitor)

Page 29: SVG Strikes Back

Pixel density in 2014iOS

1x

2x

3x

LDPI

HDPI

XXHDPI

MDPI

XHDPI

XXXHDPI

Android

Page 30: SVG Strikes Back

SVG was made for the

multi-device web.

Page 31: SVG Strikes Back

Desktop Support

All modern desktopbrowsers (IE 9+)

http://caniuse.com/#feat=svg

Page 32: SVG Strikes Back

Mobile Support

All modern mobilebrowsers (Android 4+)

http://caniuse.com/#feat=svg

Page 33: SVG Strikes Back

Drawbacks?None

(with correct images and fallbacks)

Page 34: SVG Strikes Back

Finally, SVG is a practical web technology.

Page 35: SVG Strikes Back

If it can be SVG, it should be SVG.

Page 36: SVG Strikes Back

CREATING SVG

Page 37: SVG Strikes Back

Manually

Page 38: SVG Strikes Back

https://developer.mozilla.org/en-US/docs/Web/SVG/Element

Page 39: SVG Strikes Back

https://developer.mozilla.org/en-US/docs/Web/SVG/Element

Good luck with that!

Page 40: SVG Strikes Back

https://developer.mozilla.org/en-US/docs/Web/SVG/Element

But seriously, it can be useful to

know a little.

Page 41: SVG Strikes Back

Vector Programs

Illustrator Sketch Inkscape

Page 42: SVG Strikes Back

My weapon of choice

Vector Programs

Page 43: SVG Strikes Back
Page 44: SVG Strikes Back
Page 45: SVG Strikes Back

Be careful with this. Your SVG won’t have a width/height and Internet Explorer

may not render correctly.

Page 46: SVG Strikes Back
Page 47: SVG Strikes Back

https://github.com/svg/svgo

Optimize with SVGO

Page 48: SVG Strikes Back

USING SVG

Page 49: SVG Strikes Back

Just like any other image

Page 50: SVG Strikes Back

CSS Fallback

Page 51: SVG Strikes Back

Inline Fallback

Page 52: SVG Strikes Back

What about icon fonts?

Page 53: SVG Strikes Back

• Are difficult to position • Use a single color • Annoying to update • Browser inconsistencies

Icon fonts…

Page 54: SVG Strikes Back

• Precision positioning • Multiple colors • Simple to update • Better browser consistency

SVG…

Page 55: SVG Strikes Back

To Recap…

Page 56: SVG Strikes Back

• Resolution independent • Small in file size • Cross-browser compatible • Simple to use

SVG is…

Page 57: SVG Strikes Back

• Resolution independent • Small in file size • Cross-browser compatible • Simple to use

SVG is…

Start using it today!

Page 58: SVG Strikes Back

But, that’s not all…

Page 59: SVG Strikes Back

Since it’s XML…

Page 60: SVG Strikes Back

THE DOM

Page 61: SVG Strikes Back

Inject into HTML

Page 62: SVG Strikes Back

Inspect w/ Dev Tools

Page 63: SVG Strikes Back
Page 64: SVG Strikes Back

http://www.opera.com/docs/specs/presto25/svg/cssproperties/

Style with CSS

Page 65: SVG Strikes Back

CSS Transitions

Page 66: SVG Strikes Back

Media Queries

Page 67: SVG Strikes Back
Page 68: SVG Strikes Back

Attach Events

Page 69: SVG Strikes Back

SVG.JS

http://svgjs.com

Page 70: SVG Strikes Back

SVG.JS

Page 71: SVG Strikes Back

Trianglify (D3.js)

http://qrohlf.com/trianglify/

Page 72: SVG Strikes Back

http://tomgermeau.com/2014/02/how-designers-can-create-interactive-prototypes-with-illustrator/

PROTOTYPE

Page 73: SVG Strikes Back

Wireframes

Page 74: SVG Strikes Back

Organize Layers

Page 75: SVG Strikes Back

Export to SVGThis time, we

want responsive.

Page 76: SVG Strikes Back
Page 77: SVG Strikes Back

Load into HTML

Page 78: SVG Strikes Back

Add Interactivity

Page 79: SVG Strikes Back
Page 80: SVG Strikes Back
Page 81: SVG Strikes Back

Start Local Server

Page 82: SVG Strikes Back

Set Emulation

Page 83: SVG Strikes Back

Set Emulation

Page 84: SVG Strikes Back

Open Browser

Page 85: SVG Strikes Back
Page 86: SVG Strikes Back

AND MORE

Page 87: SVG Strikes Back

http://css-tricks.com/mega-list-svg-information/

Page 88: SVG Strikes Back

THANKS!Slides:

http://bit.ly/svg-strikes-back

Tweet at me: @mbxtr