Film strip animations
A frame-by-frame icon animation, such as the tab throbber in tabs.css, can be
drawn as a film strip: every frame side by side in one SVG image, moved one
frame at a time with a translateX animation under steps(). The examples
below use the tab throbber’s 30 frames from
browser/themes/shared/tabbrowser/loading.svg. The animations only run when
prefers-reduced-motion has no preference.
Step 1: The SVG holds every frame side by side. The dashed outline is the box the icon is drawn in, one frame wide.
Step 2: A translateX animation from 0 to -100% under steps(30), one
step per frame, moves the strip by one frame width at a time. It is slowed down
here.
Step 3: overflow: hidden on the box hides every frame but the current
one.
Step 4: The same animation at 30 frames per second, which takes 1s.
The box needs the width and height of a single frame. The last frame should match the icon’s static state, so the animation ends without a jump when it is removed.