-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ways to configure EasingFunction::Steps
via new StepConfig
#17752
Add ways to configure EasingFunction::Steps
via new StepConfig
#17752
Conversation
EasingFunction::Steps
via new StepConfig
I modified them slightly so it should fall under fair use!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the StepConfig
is a bit convoluted; can you swap to EaseFunctionSteps(usize, JumpAt)
to make this a bit nicer to use? I think that's a good compromise between the initial design and the one proposed in #17777.
One other thing I appreciated about the other PR was the consistency with regard to the SVGs, generating them with the same tool that generated the others. The SVGs in this PR are more informative, but they are also very large, and the style doesn't seem to fit quite as well. Although in 17777, the svgs did not actually depict the separate step modes properly. |
crates/bevy_math/src/curve/easing.rs
Outdated
@@ -903,4 +985,71 @@ mod tests { | |||
); | |||
}); | |||
} | |||
|
|||
#[test] | |||
fn step_config_start() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure those tests are really needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it was more of an sanity check while developing the functions. They run in no time though (literally 0.0s on my machine xD) so it's not really a burden imo
Co-authored-by: François Mockers <[email protected]>
Objective
Solution
StepConfig
StepConfig
can configure both the number of steps and the jumping behavior of the functionStepConfig
replaces the rawusize
parameter of theEasingFunction::Steps(usize)
construct.StepConfig
s default jumping behavior isend
, so in that way it follows Fix rounding in steps easing function #17743Testing
JumpAt
jumping behavior. These tests replicate the visuals that can be found at https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/steps#descriptionMigration Guide
EasingFunction::Steps
now uses aStepConfig
instead of a rawusize
. You can replicate the previous behavior by replaceingEasingFunction::Steps(10)
withEasingFunction::Steps(StepConfig::new(10))
.