Before Going Vector

67
David Deraedt | Creative Cloud Consultant, Adobe What You Should Know Before Going Vector

description

 

Transcript of Before Going Vector

Page 1: Before Going Vector

David Deraedt | Creative Cloud Consultant, Adobe

What You Should Know Before Going Vector

Page 2: Before Going Vector

Disclaimer

I’m a fraud

Page 3: Before Going Vector

Disclaimer

Even worse, I’m a french fraud

Page 4: Before Going Vector

But I know people

JC Suzanne

Jon Da Costa+

Page 5: Before Going Vector
Page 6: Before Going Vector
Page 7: Before Going Vector

Scalability Expressiveness

File Size*

Page 8: Before Going Vector

Rasterizing at the right time

Page 9: Before Going Vector

What do people use vectors for?

7 %8 %

10 %

11 %

29 %

35 %

©Seb NIARK1 FERAUT©Google

Page 10: Before Going Vector

Escape From Pixel Hell

Page 11: Before Going Vector
Page 12: Before Going Vector

Vectors, in a Browser

Page 13: Before Going Vector

More than just SVG

Page 14: Before Going Vector

Vectors in the canvas (2d)

Page 16: Before Going Vector

Vectors in the canvas (3d)

Page 17: Before Going Vector

Fonts & Icon Fonts

Page 18: Before Going Vector

Atelier Serge Thoraval by JC Suzanne & J DaCosta

Page 19: Before Going Vector

Fonts & Icon Fonts Pros

➡ Scalable since it’s a true vectors icon set w/ transparent background

➡ Can be styled via CSS just like text

➡ Monochromatic, but stackable

➡ Relies on @font-face support: great support… but not perfect

Page 20: Before Going Vector

Fonts & Icon Fonts Cons

➡ Monochromatic

➡ Mixed Rendering using the system’s font renderer & AA system

➡ Positioning can be mess

➡ Not always great for semantics and accessibility

➡ Terrible fallback results (e.g. random chars unless PUA)

➡ … and other weird browser behaviors that go with such a hack

Page 21: Before Going Vector
Page 22: Before Going Vector

SVG is now the best format to draw vectors

in a browser

Page 23: Before Going Vector

Digital Evolution by HKI

Page 24: Before Going Vector

Our Agenda

• What is SVG?

• How to create SVG?

• How to optimize SVG?

• How to integrate SVG?

• How to animate SVG?

Page 25: Before Going Vector

SVG

• XML based vector 2d image format

• W3C Standard - it doesn’t belong to a privately owned company

• Paths, shapes / primitives, text, bitmaps (aka raster) images

• CSS styling via pres attributes, inline styles, <style> & external CSS!

• Blend modes & filters (aka effects)*

• Challenging interactive / animation model

• Fragmentation is more than just “support”, it’s about fidelity

Page 26: Before Going Vector

Ouch…

http://voormedia.com/blog/2012/10/creating-svg-vector-graphics-for-maximum-browser-compatibility

Tim van de Velde

Page 27: Before Going Vector

A look at Apple’s App Store badge

Page 28: Before Going Vector

The Right Tool For The Job

Page 29: Before Going Vector

Inkpad for iPad

Page 30: Before Going Vector

Ideation: Illustrator Draw for iPad

Page 31: Before Going Vector

Photoshop

Page 32: Before Going Vector

Photoshop CC 2014 Extract Assets & SVG support

Page 33: Before Going Vector

Sketch

Page 34: Before Going Vector

Illustrator feature highlight

• Great diversity of drawing tools

• Best of class path management tools (shape builder FTW)

• True global, dynamic colors and color redefinition

• Styles for elements, groups, layers, characters, paragraphs

• Advanced extensibility & plugin ecosystem

http://tv.adobe.com/watch/max-2013/theories-and-harmonies-of-color/!

Page 35: Before Going Vector

SVG Export Options

Page 36: Before Going Vector

SVG export via copy & paste

Page 37: Before Going Vector

Bulk export with Layer Exporter

Page 38: Before Going Vector

Expanding Complex Shapes and Appearance

Page 39: Before Going Vector

Flattening Blend Modes

Page 40: Before Going Vector

The Red Wedding by Brian Yap !https://www.behance.net/brianyap

Page 41: Before Going Vector

Simplifying paths

Page 42: Before Going Vector

Simpliying paths

Page 43: Before Going Vector

Applying SVG Filters

Page 44: Before Going Vector

Editing Default Filters

[HOME]/Library/Application Support/Adobe/Adobe Illustrator 18/en_US/Adobe SVG Filters.svg

Page 45: Before Going Vector

Pixel Perfect Precision

• Use pixel units, but it won't fix anything on its own

• Use Pixel Preview to check pixel precision accuracy,

• Position closed shapes to integer coordinates. Same for sizes.

• Apply a half pixel offset for the rest, using Graphic Styles

• Use Snap to Grid, but set up the grid to snap to integers.

• Do not align strokes to center

• Do not use Align to Pixel Grid.

• Be careful when using Ai files as Photoshop Smart Object

http://www.dehats.com/blog/contents/02-illustrator-and-pixel-precision!

Page 46: Before Going Vector

Optimizing SVG with SVGO-UI

Page 47: Before Going Vector

Integrating SVG

Page 48: Before Going Vector

SVG as…

• <img> tag src attribute

• inline SVG using <svg> tag

• CSS background-image

• <object>

• <iframe>

• <embed>

• data URI

• Canvas2d Image

• WebGL texture

• …

Page 49: Before Going Vector

Fallbacks for <img>

Pure HTML

HTML / JS Pure JS

Pure JS

Page 50: Before Going Vector

Fallbacks for inline SVG

Page 51: Before Going Vector

Fallbacks for background-image

Page 52: Before Going Vector

Responsive SVG

Page 53: Before Going Vector

Responsive SVG w/ media queries (Andreas Bovens)

Page 54: Before Going Vector

Issues with Responsive inline SVG (and iFrame)

!

• In IE, the height is 150px even if width is explicitly specified at 100% • …Resulting in white spaces above and below the image! • Only the (ugly) Padding Hack solves this

http://tympanus.net/codrops/2014/08/19/making-svgs-responsive-with-css/!

Page 55: Before Going Vector

Spriting SVG

https://icomoon.io/

Page 56: Before Going Vector

Spriting SVG

Definitions are injected at the top! of the HTML page!

Shapes are included as inline SVG!using the <use> tag and symbol def ID

Shapes are gathered in a single iconset.svg file as symbols!(symbols are not displayed and can be reused)!

right-arrow.svg

left-arrow.svg

Page 57: Before Going Vector

A word about build tools

Page 58: Before Going Vector

Grunt Tasks you should know about

• grunt-svgmin - optimizes SVGs using SVGO

• grunt-svg2png - rasterizes SVGs to PNG using PhantomJS

• grunticon - generates CSS w/ PNG fallbacks from SVGs

• grunt-svgstore - Merges SVGs from a folder

Page 59: Before Going Vector

Code driven vectors

Page 60: Before Going Vector

D3.js

http://bost.ocks.org/mike/uberdata/

Page 61: Before Going Vector

Snap.svg

http://snapsvg.io

Page 63: Before Going Vector

Animation

Page 64: Before Going Vector

CSS Transitions

Page 65: Before Going Vector

Clip Path animation

Page 66: Before Going Vector

Wrap-up

Now’s the time to go vector SVG

CC tools are ready for the job

Go and make something great!

Page 67: Before Going Vector

Thank you!

https://github.com/davidderaedt/Before-Going-Vector

@davidderaedt

Sara Soueidan Stéphane Baril

Michael Chaize

Stéphanie Walters

Thibault Imbert

Sylvain Gallineau

Vincent Hardy

Chris Coyer

Rich Lee

Dmitry Baranovskiy

Ultranoir

Hellohikimori

JC Suzanne

Jon Da Costa