In this article, we’ll learn the basics of SVG animation and how you can animate vector graphics with only a few steps. If you want to launch your career as a designer, or you just want to learn more about how to animate your illustrations, read on.
But first, let’s learn what are SVGs or Vector Graphics and how they can help you?
SVG stands for Scalable Vector Graphics, and it’s a set of markup and coding standards for manipulating vector images. These aren’t just any images, either; they’re scalable, animable, and have tinny file size. This makes SVG fonts really powerful since they can be repurposed for many different uses.
As you can imagine, creating SVGs is a lot easier than creating an entire image using HTML and CSS. And if you do it right, these graphics can be incredibly customizable.
SVG Animation and Effects
Like any other graphic, the animation effects for your SVG image are decided by how it’s being styled in your design. As a designer, you have control over the variables that you define.
The most common and simplest effect is the rotation. If you rotate the first image by 90 degrees, you’ll see how the animation plays out:
If you want to play the animation again, you can simply rotate the other image by 90 degrees to the right:
For a more dramatic effect, you can rotate a SVG by 90 degrees and then modify the perspective to produce an animation that slowly rotates the entire image:
Which way you rotate is determined by the numbers. 3180 becomes 25 and translates into -90. Another way to think about it is, a 180 degree rotation translates to -90 degrees on the viewable plane.
Another interesting effect is called tiling. It’s a simple trick that you’ll want to know if you want to know how to make a design with a handful of seemingly random patterned cubes. A tiling effect, once applied, can create a seamless design, like the below:
To tiling, rotate your SVG by 90 degrees and then select a few of your patterned cubes and repeat the process, such as tiling four times on your SVG:
Now, with the tiling effect on, you can scale each patterned cube up and down to create an elegant design:
Create a Moving Design Using a Function in your Draw
When you’re just starting out, you’ll mostly use functions to create elements like shapes and text. That’s because, unless you have a full set of controls, functions are the easiest way to animate your SVG designs. In a SVG you can use just a handful of basic controls, like rotate, translate, and scale:
Let’s take a look at a few of these values.
The rotation attribute can be applied to the origin, middle, or end points of your design. The default value is 90 degrees. This value should always be written in degrees.
The translate value is the horizontal offset of your design. A value of -90 translates your design 90 degrees from the left. Another common value is 0, which means your design is mapped
The scale attribute tells your SVG to scale the design up or down. In the following example, the scale value of 30 translates your design from the right to the left:
Scale is not always obvious. A few things to keep in mind: the scale value should always be written in percentage. If you’re scaling an element by multiple amounts, scale it down by all the values.
An element that is 100% scaled will appear 100% larger on the screen than it would if it was a smaller element.
You also have the option to scale an element by its size, by a fraction of the element’s size.
An element that is 50% scaled will appear 50% larger than it would if it were a smaller element.
A middle element is one that is 50% scaled, or 25% larger on the screen than its parent element.
Vector Animation can be difficult to learn if you are a beginner. If you don’t want to learn how to code these effects by hand, you can always use software that exports Vector animation format and you’ll have all the animation effects at your footprints. It’s easy to use and will help you learn the basics and navigate to more complex animations with ease.