Skip to content
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

added additional easing functions #17777

Closed
wants to merge 3 commits into from
Closed

Conversation

fjkorf
Copy link

@fjkorf fjkorf commented Feb 10, 2025

Objective

Fixes #17744

Solution

This updated adds three additional easing functions to support the full set of functions available in CSS
https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/steps#description

Three new EaseFunctions were added, and the original EaseFunction::Steps was modified.

I thought it made the most sense to have Steps be equivalent to jump-none, and added additional functions for the remaining options. StepsStart for jump-start, and so on. The original Steps function is now StepsEnd, which may be a problem .

Testing

I updated the EaseFunctions example to include the three new functions, and successfully tested the code locally.


Showcase

Screenshot from 2025-02-10 11-26-56

Migration Guide

Calls to EaseFunction::Steps would need to be updated to EaseFunction::StepsEnd to display the same behavior

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Animation Make things move and change over time A-Math Fundamental domain-agnostic mathematical operations D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 10, 2025
@alice-i-cecile
Copy link
Member

@greeble-dev can I get your review here? :)

@alice-i-cecile alice-i-cecile added the M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Feb 10, 2025
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels both clearer and more consistent with CSS to add an enum and specify this behavior inside of the existing Steps variant. That will also make the migration easier and more automatic.

@greeble-dev
Copy link
Contributor

greeble-dev commented Feb 10, 2025

Awkward.... I think this PR and #17752 both implement the same feature.

#17752 has the advantage of addressing @alice-i-cecile 's comment about making the jump behaviour an enum, and includes updated svgs. But this PR is a bit simpler - the other adds a StepConfig intermediate struct that makes things a bit verbose.

let c = EasingCurve::new(2.0, 4.0, EaseFunction::Steps(StepConfig::new(4).with_jump_at(JumpAt::Start)));

I'd be happy to review either PR in more detail, but I'm reluctant to do that with both in play.

@greeble-dev
Copy link
Contributor

greeble-dev commented Feb 10, 2025

Although I'll walk that back slightly - if a maintainer says "I'd rather you review both PRs and then we'll see what happens" then I can do that.

@alice-i-cecile
Copy link
Member

Let's coalesce the efforts in #17752 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Animation Make things move and change over time A-Math Fundamental domain-agnostic mathematical operations C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support more "step" easing modes
3 participants