CKTIS / CSS
steps(): discrete timing with explicit jump positions
Hold animation progress on plateaus and choose whether it jumps at the interval’s beginning or end.
Version: CSS Modules
Syntax
animation-timing-function: steps(4, jump-end);The easing function steps() divides input progress into equally spaced intervals and keeps output constant within each interval. Its first argument is a positive integer; the optional position defaults to end, equivalent to jump-end. The aliases start and jump-start select an initial jump. This is a timing function, not a request for a particular frame rate or a count of animation repeats.
The jump-none position excludes jumps at both outer boundaries and requires at least two steps. jump-both includes a jump at each outer boundary; its interior plateaus use increments of 1/(n+1). With n equal to four, the none variant uses increments of one third, while the both variant uses one fifth. Endpoint and boundary behavior also depends on the animation phase; the example fixes normal forward playback and a single iteration rather than claiming to cover reversed or before-phase sampling.
The paused browser animation is sampled at 0,249,250,500,999 and 1000 milliseconds over a 1000ms duration. The end variant yields 0,0,0.25,0.5,0.75,1; the start variant begins at 0.25. The none and both rows reveal their different plateau heights, and the exact 250ms sample lands on the next plateau. Zero steps and a single step with the none position are rejected, while two steps with none and the default position parse successfully.
Examples
const box = document.createElement('div');
document.body.append(box);
for (const position of ['jump-end','jump-start','jump-none','jump-both']) {
const animation = box.animate([{opacity:0},{opacity:1}], {
duration:1000, fill:'both', easing:'steps(4,' + position + ')'
});
animation.pause();
const values = [0,249,250,500,999,1000].map(time => {
animation.currentTime = time;
return Number(animation.effect.getComputedTiming().progress.toFixed(6));
});
console.log(position + ':', values.join(','));
animation.cancel();
}
for (const value of ['steps(0)','steps(1,jump-none)','steps(2,jump-none)','steps(4)']) {
console.log(value + ':', CSS.supports('animation-timing-function',value));
}
box.remove();Result
jump-end: 0,0,0.25,0.5,0.75,1 jump-start: 0.25,0.25,0.5,0.75,1,1 jump-none: 0,0,0.333333,0.666667,1,1 jump-both: 0.2,0.2,0.4,0.6,0.8,1 steps(0): false steps(1,jump-none): false steps(2,jump-none): true steps(4): true
These values come from the Web Animations timing model with explicit currentTime values, not from sleeping or counting rendered frames. Motion-heavy interfaces still need reduced-motion handling and a usable nonanimated state.