Home / Best Practices / Images: Animation

Images: Animation

Basics

  1. All images, including animated images, must have alternative text (see Images: Alternative Text).
  2. Any animation that starts automatically and moves for more than 5 seconds must provide a way to pause the movement.

In depth

An image that starts automatically and moves for more than 5 seconds must provide a way to pause the movement. This applies to element transitions, animated gifs, parallax scrolling, and code-based moving elements such as data visualizations and animated features.

Why? Automatic movement can trigger vertigo and seizures in users with some vestibular conditions, and it is distracting to users with some learning and cognitive disorders. However, sometimes no other method will achieve the desired effect, and animation is necessary. In these cases, ensure that your animations comply with WCAG 2.1 guidelines.

Animated Gifs

For animated gifs, do one of the following:

  1. Provide a play button: The Giffer script will provide a play button on animated gifs, allowing for greater user control over the interface (instructions for implementing the Giffer script).
  2. Provide a pause button: We currently know of no programmatic way to automatically play a video while providing a pause button. If anyone comes across one, please let us know.
  3. Play (loop) the animation for less than 5 secs: You will need to modify the number of times an animation loops.
    1. Open the animated gif in Photoshop.
    2. Go to Window > Timeline (if the Timeline panel is not already open).
    3. At the bottom of the Timeline panel, you will see an option that says "Forever." Change that to "Once" (or choose "Other" and change it to "2," depending on the length of the animation).
      Timeline panel in Photoshop, showing the loop time options
    4. Go to File > Export > Export for Web and save it as a gif.

ASU Web Standards

In addition to WCAG 2.1, ASU has additional university standards for animation. Even if your site is not a college or unit site, we recommend you take a look at these standards as they are detailed and well-researched.

How to test

Manually inspect any pages with animated elements. If they automatically play, they must either (a) provide a pause button or (b) automatically stop after 5 seconds. The best user experience is to not automatically play animations, but to give the user a play button and, thus, as much control over the user interface as possible.

Relevant W3C WAI documents

  • WCAG 2.1 Guideline 2.2.2 Pause, Stop, Hide: For any moving, blinking or scrolling information that (1) starts automatically, (2) lasts more than five seconds, and (3) is presented in parallel with other content, there is a mechanism for the user to pause, stop, or hide it unless the movement, blinking, or scrolling is part of an activity where it is essential...
  • How to Meet WCAG 2.1 Guideline 2.2.2