The Flavors of SVG

John Ferris / @pixel_whip
http://pixelwhip.github.io/svg-flavors

Aten Design Group
Aten's Clients
SVG Logo
It's Markup!

  
  
  It's Markup!
kool-aid man

Scaled

Animated

Filtered

Styled

Scripted

kool-aid man

                  
  
kool-aid man
/* CSS Animation */
@keyframes wave-hello {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(20deg);}
}
#left-arm {
  animation: wave-hello 1s infinite linear alternate;
  transform-origin: 135px 195px;
}
kool-aid man

                  

  

...
 
kool-aid man

                  /** CSS Styles **/

 
kool-aid man
width: 400px;
kool-aid man
width: 300px;

                  /** Embedded Media Queries **/
@media (max-width: 360px) {
  .kool-aid { fill: orange; }
  .oh-yeah { display: none; }
  .oh-no { display: block; }
}
 

Embed Methods

<img/>

kool-aid-man
Animation Script w/ JS Style w/ CSS Cached
SMIL CSS JS Embedded External
Yes Yes No No Yes No Yes

Fallback: Inline

kool-aid-man

Fallback: SVGeezy

SVGeezy

Fallback: Picturefill



  
  
  
  Kool Aid Man



                  

background-image: url();

.icon--kool-aid { background-image: url(img/kool-aid-man.svg); }
Animation Script w/ JS Style w/ CSS Cached
SMIL CSS JS Embedded External
Yes Yes No No Yes No Yes

Fallback: Modernizr

.icon--kool-aid { background-image: url(img/kool-aid-man.svg); }
.no-svg .icon--kool-aid { background-image: url(img/kool-aid-man.png); }
Modernizr Screenshot

<object/>

Animation Script w/ JS Style w/ CSS Cached
SMIL CSS JS Embedded External
Yes Yes Yes Yes Yes No Yes

Fallback: Alternative Content


  Kool-aid Man

Inline <svg/>


  
  
  
  ...

Animation Script w/ JS Style w/ CSS Cached
SMIL CSS JS Embedded External
Yes Yes Yes Yes Yes Yes No
Animation Script w/ JS Style w/ CSS Cached
SMIL CSS JS Embedded External
<img/> Yes Yes No No Yes No Yes
background-image Yes Yes No No Yes No Yes
<object/> Yes Yes Yes Yes Yes No Yes
<svg/> Yes Yes Yes Yes Yes Yes No

SVG Injector

kool-aid-man


// Elements to inject
var mySVGsToInject = document.querySelectorAll('img.inject-me');
// Trigger the injection
SVGInjector(mySVGsToInject);
Animation Script w/ JS Style w/ CSS Cached
SMIL CSS JS Embedded External
Yes Yes Yes Yes Yes Yes Yes

*Requires Javascript

Logos



  
  ...
  ...
  
    
    
    
  

    

/* Mark only */
#horizontal,
#stacked {
  display: none;
}

/* Horizontal */
@media all and (min-aspect-ratio: 570/270) {
  #horizontal { display: block; }
  #mark { display: none; }
}

/* Stacked */
@media all and (max-aspect-ratio: 12/18) {
  #mark,
  #stacked-design { display: none; }
  #stacked { display: block; }
}

/* Full */
@media all and (max-aspect-ratio: 120/205) {
  #stacked-design { display: block; }
}

Icons

Copyright © Jolly Icons by Olly Holovchenko 2013

Copyright © Jolly Icons by Olly Holovchenko 2013

Copyright Roberts OzolinsFlat

Grunticon Chart

SVG Sprites

icons.svg


  
  
  

index.html


  

Animations

See the Pen Form with Animation That Assists in UX by Sarah Drasner (@sdras) on CodePen.

Data Visualization

Non-Rectangular Interfaces

Created with Circulus.svg by Sara Soueidan. Animated with GSAP.

:

Tools

SVG specific libraries

Creating & Editing

Optimization

Animation Libraries

See the Pen VelocityJS + SVG = ♡ by LegoMushroom (@sol0mka) on CodePen.

Data Visualization

Resources

SVG How-to

Inspiration

Icons

kool-aid man

Thank You