SVG animation. Introduction

Published: (April 2, 2026 at 11:39 AM EDT)
1 min read
Source: Dev.to

Source: Dev.to

There are multiple ways to make your SVG animated:

  • SVG/SMIL
  • CSS animation
  • JavaScript

SVG/SMIL

SMIL stands for Synchronized Multimedia Integration Language, an XML‑based language that allows you to animate various attributes directly inside the SVG element. An advantage is that the animation is preserved even when the SVG is embedded via <img>.

Some discussions claim SMIL is obsolete, but according to caniuse SVG SMIL is still fully supported by major browsers.

SMIL defines several animation elements that can be used directly inside SVG elements, such as animate, set, animatemotion, animatecolor, etc., enabling shape changes and other effects.

For a detailed guide on using SVG/SMIL, see the article “A Guide to SVG Animations with SMIL” on CSS‑Tricks.

CSS

Using CSS to animate SVG is preferable when the animation is simple and relies on presentation attributes, the transform property, or other CSS properties. See the discussion of presentation attributes for more details.

JavaScript

JavaScript can manipulate DOM elements, making it a powerful tool for SVG animation. In particular, the animate method can be used to create complex, script‑driven animations.

0 views
Back to Blog

Related posts

Read more »

10 Cool CodePen Demos (March 2026)

2026 F1 Drivers Custom Select using appearance: base-select Chris Bolson crafted one of the most impressive custom selects I've seen. It doesn’t even look like...

Execution Context

Bayangkan Execution Context seperti sebuah dapur. Sebelum kamu memulai memasak mengeksekusi kode, kamu perlu ruang kerja, peralatan variabel, dan resep function...