Blog
Aug 5, 2026 - 69 MIN READ
Animating SVG on the web

Animating SVG on the web

so you want buttery smooth vector-based animations that work everywhere and are easy to create? haha good luck dumbass

Oskar

Oskar

spaghetti chef

The Problem

I wanted to have neat looking vector-based animations for this very site. Let's take the header logo as an example for what I'm trying to build.

As you can see, there's a bunch of moving pieces and path transforms.

And as is the case with mostly everything web-based, there are many ways to approach a problem. Here is a quick overview of the avenues that came to my head:

Animating d property with CSS @keyframes

  • pros
    • relatively easy to implement
    • works without js
  • cons
    • safari doesn't support it
    • hard to maintain

SVG <animate> element

  • pros
    • works without js
    • works on all major browsers
    • works even in github readme (see example)
  • cons
    • super annoying to create
    • weirdly hard to find documentation besides the spec

Lottie + Adobe After Effects

  • pros
    • easiest to implement; AE is a professional tool
    • can handle complex animations with many layers
  • cons
    • AE is paid Adobe software
    • only works with js, has an impact on bundle size

Using a library in JS

My preferred pick for this is anime.js. I know GSAP went free recently, but the couple of minutes I spent looking at it made it feel comparatively clunky and old. Also the anime.js documentation is just super pretty to look at.

  • pros
    • relatively easy to implement; can handle path transformations automatically
    • can orchestrate and sync with other animations
  • cons
    • only works with js, has an impact on bundle size
    • said path transforms can sometimes look weird if not carefully crafted