ArticleslgStudy

science

SVG animation

SVG animation is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand SVG animation rather than just read about it. In short: Animation of Scalable Vector Graphics, an open XML-based standard vector graphics format is possible through various means: Scripting: ECMAScript is a primary means of creating animations and interactive user interfaces within SVG. Styling: Since 2008, the development of CSS Animations as a feature in WebKit has made possible stylesheet-driven implicit animation of SVG files from within the Document Object Model (DO…

SVG animation — main illustration
SVG animation — illustration

Key takeaways

  • SVG animation belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect SVG animation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of SVG animation from memory before moving on to harder problems.

Reference excerpt

Animation of Scalable Vector Graphics, an open XML-based standard vector graphics format is possible through various means:

Scripting: ECMAScript is a primary means of creating animations and interactive user interfaces within SVG. Styling: Since 2008, the development of CSS Animations as a feature in WebKit has made possible stylesheet-driven implicit animation of SVG files from within the Document Object Model (DOM). SMIL: Synchronized Multimedia Integration Language, a recommended means of animating SVG-based hypermedia, supported by the Amaya (2003) Opera (2006), Mozilla Firefox (2011), Google Chrome (2016) and Safari (2017) web browsers, and any browser that aims to pass the Acid3 web standards test of 2008 (i.e. before the test's "simplification" in 2011) as this requires SMIL support for tests 75 and 76. Libraries have also been written as a shim to give current SVG-enabled browsers SMIL support. This method is also known as SVG+Time. Because SVG supports PNG and JPEG raster images, it can be used to animate such images as an alternative to APNG and Multiple-image Network Graphics (MNG).

History SVG animation elements were developed in collaboration with the working group that published several versions of Synchronized Multimedia Integration Language (SMIL). The SYMM Working Group (in collaboration with the SVG Working Group) developed the SMIL Animation specification, which defines a general-purpose XML-based animation feature set. SVG incorporates the animation features defined in the SMIL Animation specification and provides some SVG-specific extensions. In June 1998, the "Synchronized Multimedia Working Group" (known as "SYMM") within the World Wide Web Consortium ("W3C") published the first recommended version of the specification known as "SMIL 1.0". Shortly after the 1998 publication of SMIL 1.0, a group of companies led by Microsoft published "Timed Interactive Multimedia Extensions for HTML (HTML+TIME); Extending SMIL into the Web Browser". For the next two years, the lead author of HTML+TIME (Patrick Schmitz) worked with the SYMM working group, while also working with the SVG working group. Shortly after the publication of SMIL 2.0, Schmitz and co-author Aaron Cohen (from Intel) published SMIL Animation on 4 September 2001. SVG 1.0 also became a W3C Recommendation on 4 September 2001. Certain web browsers added support for SVG animation during the 2000s, including Amaya as early as 2003, but SVG animation was only supported by widely used browsers beginning in the 2010s, notably by Firefox 4 (2011). Internet Explorer supports ECMAScript animation, and its successor Microsoft Edge supports ECMAScript and CSS animations as of version 42.17134.

Examples

The following code snippets demonstrate three techniques to create animated SVG images on compatible browsers. The relevant parts are highlighted in yellow. Click the images' thumbnails to see their animated versions.

SVG animation using SMIL See file SVG animation using SMIL.svg.

SVG animation using CSS See file SVG animation using CSS.svg.

SVG animation using ECMAScript

Though the example above works, it is not the optimal implementation; the animation is limited to 50 frames per second (FPS). Using requestAnimationFrame provides better performance and can reach 60 FPS:

SMIL attributes to identify the target attribute The following are the animation attributes which identify the target attribute for the given target element whose value changes over time. attributeName = "<attributeName>" specifies the name of the target attribute. An XMLNS prefix may be used to indicate the XML namespace for the attribute. The prefix will be interpreted in the scope of the current animation element. attributeType = "CSS | XML | auto" specifies the namespace in which the target attribute and its associated values are defined. CSS specifies that the value of ‘attributeName’ is the name of a CSS property defined as animatable in this specification. XML specifies that the value of ‘attributeName’ is the name of an XML attribute defined in the default XML namespace for the target element. The attribute must be defined as animatable in this specification. auto The default value is 'auto'. The implementation should match the ‘attribute Name’ to an attribute for the target element. The implementation must first search through the list of CSS properties for a matching property name, and if none is found, search the default XML namespace for the element.

The MediaWiki wiki software automatically generates static, non-animated thumbnails of SVG images. Viewing the actual .svg image from each respective description page will show its animation in a compatible browser.

Libraries There are several JavaScript libraries for working with SVG animation. An advantage to the use of such libraries is that these libraries often solve incompatibility issues in browsers through abstraction. Examples of libraries include Raphaël and Velocity.js

See also

CSS animations D3.js Flash animation GIF animation

References

Illustrations

SVG animation illustration
SVG animation illustration
SVG animation illustration
SVG animation illustration

Worked examples

Example 1 — a first encounter with SVG animation

Start with the simplest possible case. Write down what SVG animation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to SVG animation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about SVG animation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of SVG animation

In research
SVG animation appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses SVG animation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
SVG animation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Animation techniques, Scalable Vector Graphics, Web animation, so understanding it makes those chapters shorter.
In everyday life
Look for SVG animation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “SVG animation” →

How to study SVG animation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what SVG animation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain SVG animation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is SVG animation in simple terms?

Animation of Scalable Vector Graphics, an open XML-based standard vector graphics format is possible through various means: Scripting: ECMAScript is a primary means of creating animations and interactive user interfaces within SVG. Styling: Since 2008, the development of CSS Animations as a feature…

Why does SVG animation matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study SVG animation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on SVG animation.

Tags

  • Animation techniques
  • Scalable Vector Graphics
  • Web animation

Keep exploring