At InVision, I’m building a small user interface (UI) that loads a list of documents and then caches them in memory for all subsequent renderings of the UI. During that one-time-only loading phase, I’m showing the static text, Loading....
, in the view. But, this static text got me thinking about low-effort animations. And, whether or not I could use CSS @keyframes
animations to animate the ellipsis portion of that text. It turns out, animating the content
property works in modern browsers!
Normally with @keyframes
animations, we use the timeline to define numeric CSS properties that can be animated gracefully using some sort of timing function. That said, it appears that we can use individual keyframes to set the state for non-animatable properties. These properties will be applied for the duration of the keyframe; but, will not receive any sort of transitiony magic.
In this demo, I’m animating the content
property in order to apply an increasing number of dots (.
) in the Loading....
#html / css #css #css keyframes #css keyframes animation