SVG Drawing Animation

A little experiment that explores the usage of SVG line drawing animations to precede the appearance of graphics or website elements, simulating the loading of them.

From our sponsor: Don't spend all day sending messages. Automatically reach out to fans based on how they behave.

SVG is finally becoming a more utilized and fun website component. It’s really powerful and there are many creative possibilities for fun effects on a website using SVG. Today we’d like to share two experimental concepts with you that make use of stroke animations, made popular by the animations on the PlayStation 4 and Xbox One review sites. This technique was introduced and explained by Jake Archibald in his article Animated line drawing in SVG and also explored by Brian Suda in his article Animating Vectors with SVG for 24Ways. For our experiments we are using his code to animate the strokes of the paths.

So, what concepts did we explore? The first one is a line drawing animation that fades into a “real” image or illustration once the respective figure is in the viewport. This can be a fun effect for any kind of illustration on a website. The second concept explores using SVG line drawing animations for simulating the loading of a website: website parts are represented by flat drawings with a stroke that gets animated and once finished, the “real” elements are shown. The technique itself is implemented in a static way where we use an SVG for every bunch of elements that fade in. The idea for the schematic representation of the website come from this awesome Dribbble shot by Chris Bannister.

The beautiful illustrations of the devices are by Pixeden and you can find the PSD files here:

The traced SVG line drawings of these illustrations were carefully crafted by talented Emanuel Serbanoiu. Check out his Dribbble profile or visit his website.

The first demo is the line drawing animation with the illustration fade-in:

The second demo is the line drawing animation with the website fade in:

And the third demo is similar to demo 2, just that the animation and the fading in of the elements happens sequentially but with a random timing:

We hope you like the effects and find them inspiring!

Tagged with:

Mary Lou

ML is a freelance web designer and developer with a passion for interaction design. She studied Cognitive Science and Computational Logic and has a weakness for the smell of freshly ground peppercorns.

Stay up to date with the latest web design and development news and relevant updates from Codrops.

CSS Reference

Learn about all important CSS properties from the basics with our extensive and easy-to-read CSS Reference.

It doesn't matter if you are a beginner or intermediate, start learning CSS now.

Feedback 80

Comments are closed.
  1. Woow! This is so cool. I’m going to dissect the demo-code. I’m a major fan of SVG! I can draw my own illustrations in Adobe Illustrator, save them as SVGs ,then copy and paste applicable code and add them as inline-svg. Only down side is your HTML is starting to get big and less readable.

    Mary Lou did you give Snap.svg a try?

  2. How did you code? lol

    I see such as these codes in html file:

    <path d="m 579.44258,124.24714 c 0,0 26.94592,-21.17898 59.75842,0 l 123.29566,73.28106 c 0,0 33.20953,17.10157 …

    Is there any editor for this?

    • SVG is actually based on XML. I like Sublime Text and Webstorm. One of the best and free drawing-tools is Inkscape for altering SVGs. eg you can reverse paths with Inkscape (drawing direction when doing animation). This is not possible with Adobe Illustrator.

  3. I was also fiddling with SVGs retrieved from an XML-file with Ajax but it’s slow is hell Have to load and insert 53 SVGs. And doing the same dashoffset-animation. Yep I’m no JS-scriptkid SVG/JS/SMIL/CSS3-test

  4. Amazing as always !! Is there any generator who can generat svg Html Code of an uploaded image ? or it has to be done manually ?? thanks

    • Depends if the image is an illustration then you could (re-)trace it with Illustrator, Inkscape. When you have a bitmap picture it is not usable as a SVG. That’s way to complicated. You’ll end up with a SVG of zillion lines of paths and other shapes. You can test that by tracing the pic with Illustrator and then save as SVG.

  5. Awesome! Really love SVG. Need to start a project on this soon, love the idea of the loading transition, looks great.

  6. This is an interesting wayu to use SVG. I used SVG paths mixed with the scrolling parallax plugin Skollr to create a cool line chart that looked animated on scroll. You can check it out Here . Just scroll down to view. the bar chart just uses CSS animations. Great tutorial. Always great stuff here!

  7. Inspiring.. it would be a nice idea to include a tutorial on how to design SVGs as well .