Fix steps() jump-start returning 0 at t=0#1179
Open
chatman-media wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
steps(n, true)is meant to behave like CSS'sjump-start: the first step happens the moment the interpolation begins, sostep-start(steps(1, true)) should jump straight to its final value instead of sitting at 0 for a frame. Right now it's justceil(t*n)/n, which produces the exact same curve asjump-endat 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 forstep-startsince nothing was covering that edge.