16 SVG Animation Tutorials

One of the most useful things about SVG is that it’s resolution independent, meaning that you don’t need to think about how many pixels you have on your device, the result will always scale and be optimized by the browser to look great. SVG is not just about creating static graphics, however, it is also a powerful animation tool. In this post, we have collected ten tutorials that will help you learn how to create SVG animation for your website.

An introduction to SVG animation

Scalable Vector Graphic, or SVG, is an image format we utilise as much as possible in our projects. An SVG’s small file size, in addition to its ability to scale (clue’s in the name, there!) wonderfully to any size makes it a fantastic tool for the web. If you’re happy to fall back to less interesting alternatives (or include polyfills) for IE users, there are many great things you can do with SVG.

svg-animation-5

Using SVG

SVG is an image format for vector graphics. It literally means Scalable Vector Graphics. Basically, what you work with in Adobe Illustrator. You can use SVG on the web pretty easily, but there is plenty you should know.

svg-animation-10

Creating Shapes with SVG : An SVG Tutorial

This article will serve as an introduction to SVG. It will give you basic information how to draw SVG shapes using basic XML. If you have not used SVG before, this is a good start for you. So let’s jump in and start this awesome tutorial.

svg-shape

Animated line drawing in SVG

The easiest way to animate SVG is using CSS animations or transitions. The downside is it doesn’t work in IE, if you want IE support you’ll need to use requestAnimationFrame and update the values frame by frame with script.

svg-animation-9

Polygon feature design: SVG animations for fun and profit

Polygon, as a site, is designed to be responsive. However, standard image formats like jpg, gif, or png don’t don’t always perform well when asked to enlarge or shrink dimensions as dictated by the user’s browser size. SVGs, on the other hand, take on responsive properties perfectly: vectors can increase or shrink to arbitrary sizes without any loss of fidelity, and animations and operations done on SVG elements adjust relative to its size without any additional work.

svg-animation-1

Animated SVGs: Custom easing and timing

This chart, and one other animation on Sprout, were initially GIFs. By using animated SVGs instead of GIFs we were able to reduce our page size from 1.6 mb to 389 kb, and reduce our page load time from 8.75 s to 412 ms. That’s a huge difference.

svg-animation-2

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.

svg-animation-3

Animated SVG Icons with Snap.svg

Using SVGs on websites is becoming more and more easy with great libraries like Snap.svg. Today we want to explore what we can do with it and animate some SVG icons as a practical example.

svg-animation-4

Animating Vectors with SVG

Unlike rasterized images, SVG files will stay crisp and sharp at any resolution. With high-DPI phones, tablets and monitors, all those rasterized icons are starting to look a bit old and blocky. There are several options to get simpler, decorative pieces to render smoothly and respond to various device widths, shapes and sizes. Symbol fonts are one option; the other is SVG.

svg-animation-6

How to Animate Festive SVG Icons With CSS

If you’re interested in using SVG on the web, icons are a great place to start. SVGs are flexible, resolution independent, and light weight, so icons naturally lend themselves to the vector format. Plus, just like HTML, SVGs can easily be styled with CSS, which includes CSS3 animation. Adding a dash of interactivity with animation to your icons can help create a delightful experience for your users and also add context about what an icon represents.

svg-animation-7

SVG Path Animation with jQuery and Illustrator

In this tutorial we will build a path animation using a super slick jQuery Plugin called Lazy Line Painter by Cam O’Connell. Cam is a London based front-end web developer with a passion for building interactive web applications and plugins. Here is the Demo and Source files for what we will be building.

svg-animation-8

Using SVG stroke Attributes

Using SVG inline provides total access to the graphic for complete customization and control over its output. This is especially handy when creating shapes by hand in the browser, or making edits to an existing graphic.

svg-tuts

Making a SVG HTML Burger Button

SVG paths CAN have an animated stroke that runs along the path, however this is created using two properties. ‘stroke-dasharray’ which makes a dashed line even spaces, and ‘stroke-dashoffset’ which moves the dashes. Most tutorials show this in use to animate a path in one direction, using a super long stroke length which in turn creates a super wide stroke gap when using a dashed line.

hamburger-button

Animating SVG with svg.js

In this post we’ll walk through writing SVG animations with JavaScript using a library called svg.js. I believe this is the most mature SVG manipulation library to date.

svgjs

Animated Checkboxes and Radio Buttons with SVG

By animating an SVG path with JavaScript, we can do many fancy things. Today we want to show you some effects for checkboxes and radio buttons. The idea is to hide the inputs, use pseudo-elements to create a more appealing style and then animate the SVG paths once an input is selected.

checkbox

Animating SVG With Clipping Masks and CSS

Having said that, animating SVG elements with pure CSS has its limitations. You can’t really ‘paint’ SVG paths, strokes or fills into the HTML canvas as you can with jQuery and other JavaScript libraries. You can however, animate dash-offsets of paths to give the impression of ‘line-drawing’.

svg-tuts-16


2 Comments

  1. Thanks for the collection. It’s a very useful resource for beginners to see what they might be able to do with SVG without breaking the web (or worse: the browser).
    😉

  2. Great tutorials. Have a look at http://www.gifficons.com, we create professional animated SVG icons and giving away for free 🙂

Leave a comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked