Fireship · @fireship
Make Awesome SVG Animations with CSS // 7 Useful Techniques
Uploaded March 26, 2021 · Length 12:20
Summary
learn 7 svg animation techniques using css to create interactive web graphics
- svg animation
- css animation
- web graphics
- interactive design
- duotone icons
- vector graphics
- html css svg
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:01
combining scalable vector graphics with
- 0:03
css animation
- 0:04
is one of the most powerful techniques
- 0:06
that web designers have at their
- 0:07
disposal to stand out from the
- 0:08
competition
- 0:09
just look at all the amazing animated
- 0:11
duotone icons on the stripe homepage
- 0:14
or this looping animated explainer
- 0:15
sequence on the gatsby homepage
- 0:17
you don't need to be an expert designer
- 0:19
animator or developer to create things
- 0:21
like this
- 0:22
oh that was easy in today's tutorial
- 0:24
you'll build two things an animated icon
- 0:26
the user can interact with and a looping
- 0:28
animated sequence
- 0:29
all of which are powered by just svg and
- 0:32
css
- 0:32
and in the process you'll learn seven
- 0:34
cool techniques that have helped me with
- 0:36
vector graphics on the web over the
- 0:37
years
- 0:38
if you're new here like and subscribe
- 0:39
sadly half the people that watch my
- 0:41
content
- 0:41
aren't actually subscribed yet first of
- 0:43
all what is a scalable vector graphic
- 0:45
well what it isn't is a raster image
- 0:47
like a png or jpeg image that you might
- 0:50
take on your phone
- 0:51
those formats represent an image with a
- 0:53
grid of pixels and that means the
- 0:54
resolution
- 0:55
is dependent on the number of pixels in
- 0:57
the image to get a higher resolution
- 0:59
image
- 0:59
you need a bigger matrix with more
- 1:01
pixels in it in contrast
- 1:02
a vector image uses a totally different
- 1:04
approach that's based on geometry and
- 1:06
math instead of static pixels
- 1:08
if you open an svg file in your editor
- 1:10
you'll notice it looks exactly like html
- 1:12
markup
- 1:13
the svg tag has an attribute called view
- 1:15
box that defines a grid
- 1:17
then any graphics that are computed
- 1:18
inside that grid can be scaled up to any
- 1:21
size
- 1:21
because you're just multiplying the math
- 1:23
in that grid by the image resolution
- 1:25
now inside the svg tags we have a bunch
- 1:27
of different elements
- 1:28
like rect circle and polygon to draw
- 1:31
basic shapes
- 1:31
the shapes have different attributes to
- 1:33
define their xy coordinates and size
- 1:35
then you have the path element which is
- 1:37
the most powerful element in an svg
- 1:39
because it's like having access to an
- 1:40
imaginary pen where you can define any
- 1:42
sequence of lines and curves
- 1:44
now it's good to know what's inside an
- 1:45
svg but you should rarely need to write
- 1:47
the actual graphics code by hand
- 1:49
instead you should be having a graphic
- 1:51
designer do that in a design tool like
- 1:53
figma illustrator or inkscape all of
- 1:55
which can export vector graphics to the
- 1:57
svg format
- 1:58
now once a graphic has been drawn there


