concept
Keyframe segment easing — CSS reference
Easing attached to a keyframe applies to the interval from that keyframe toward the next relevant keyframe, rather than the entire animation. The last keyframe has no following interval.
Formal Syntax & Structure
css syntaxcss
@keyframes pulse { from { opacity:.2; animation-timing-function:steps(2,jump-end) } to {opacity:1} }Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>keyframe-segment-easing</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#a{width:100px;height:60px;padding:0;opacity:.3;background:#2855ac;color:white;animation:pulse 1s linear both paused}@keyframes pulse{from{opacity:.2}to{opacity:1}}@keyframes pulse{from{opacity:.2;animation-timing-function:steps(2,jump-end)}to{opacity:1}}</style><body><button id="toggle" type="button">Play / pause</button><div id="a">Animated panel</div><script>const a=document.querySelector('#a');document.querySelector('#toggle').onclick=()=>{a.style.animationPlayState=getComputedStyle(a).animationPlayState==='paused'?'running':'paused'};async function seek(t,p='opacity'){const xs=a.getAnimations();for(const x of xs){x.pause();await x.ready;x.currentTime=t;}return getComputedStyle(a).getPropertyValue(p)}</script></body></html>