Animations with Keyframes
suggest change@keyframes defines intermediate states for a CSS animation:
@keyframes pulse {
0%,
100% {
transform: scale(1);
}
50% {
transform: scale(1.06);
}
}
.status-indicator {
animation: pulse 1.2s ease-in-out infinite;
}
The animation shorthand above supplies the name, duration, timing function, and iteration count. Other useful longhands include animation-delay, animation-direction, animation-fill-mode, and animation-play-state.
Use the unprefixed @keyframes and animation syntax. Provide a reduced-motion alternative for nonessential movement:
@media (prefers-reduced-motion: reduce) {
.status-indicator {
animation: none;
}
}
Animations should not be the only way important state changes are communicated.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents