Skip to content

Fix steps() jump-start returning 0 at t=0#1179

Open
chatman-media wants to merge 1 commit into
juliangarnier:masterfrom
chatman-media:fix/steps-easing-jump-start
Open

Fix steps() jump-start returning 0 at t=0#1179
chatman-media wants to merge 1 commit into
juliangarnier:masterfrom
chatman-media:fix/steps-easing-jump-start

Conversation

@chatman-media

Copy link
Copy Markdown

steps(n, true) is meant to behave like CSS's jump-start: the first step happens the moment the interpolation begins, so step-start (steps(1, true)) should jump straight to its final value instead of sitting at 0 for a frame. Right now it's just ceil(t*n)/n, which produces the exact same curve as jump-end at every boundary — steps(4, true) returns 0 at t=0 when it should return 0.25.

Swapped it for floor(t*n)+1 (clamped to n), which matches the actual CSS spec algorithm. Updated the existing "steps from start" test since it was asserting the old (wrong) values, and added a dedicated test for step-start since nothing was covering that edge.

steps(n, true) is supposed to behave like CSS's jump-start: the first
step happens the instant the interpolation begins, so step-start
(steps(1, true)) should render its final value right away instead of
waiting a frame. Right now it just does ceil(t*n)/n, which gives the
same result as jump-end at every step boundary and leaves you at 0
until t moves past the first interval.

Swapped it for floor(t*n)+1 (clamped to n), which is what the spec
actually describes, and updated the existing "steps from start" test
plus added one for step-start specifically since nothing was covering
that boundary case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant