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

Fix rounding in steps easing function #17743

Merged
merged 1 commit into from
Feb 8, 2025
Merged

Conversation

rparrett
Copy link
Contributor

@rparrett rparrett commented Feb 8, 2025

Objective

While working on #17742, I noticed that the Steps easing function looked a bit suspicious.

image

Comparing to the options available in css:

image

It is "off the charts," so probably not what users are expecting.

Solution

Use floor when rounding to match the default behavior (jump-end, top right) in css.

image

Testing

I had to modify an existing test that was testing against the old behavior. This function and test were introduced in #14788 and I didn't see any discussion about the rounding there.

cargo run --example easing_functions

Migration Guide

EaseFunction::Steps now behaves like css's default, "jump-end." If you were relying on the old behavior, we plan on providing it. See #17744.

@rparrett
Copy link
Contributor Author

rparrett commented Feb 8, 2025

cc @RobWalt

Copy link
Contributor

@RobWalt RobWalt left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

I think it would be good to support all of the CSS modi of steps via configuration options somewhere. Can you open an issue and link to this PR please? I'll tackle it later on when I'm back home (on mobile atm)

Copy link
Contributor

@Carter0 Carter0 left a comment

Choose a reason for hiding this comment

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

Can you take a screenshot of what it looks like with your changes?

It does look odd on close inspection. It starts like halfway through a step I think. And then I swear the vertical lines are slightly bent. Maybe I’m seeing things tho

@rparrett
Copy link
Contributor Author

rparrett commented Feb 8, 2025

It starts like halfway through a step I think.

That's the appearance, but I would say "it advances half-way through the step."

And then I swear the vertical lines are slightly bent. Maybe I’m seeing things tho

That's to be expected based on the sampling that's happening in the example.

Can you take a screenshot of what it looks like with your changes

Sure

@rparrett
Copy link
Contributor Author

rparrett commented Feb 8, 2025

Looking into the failing test. It succeeds locally.

edit: Oh, oops. Just failed to push the new test code.

@mweatherley mweatherley added C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it A-Math Fundamental domain-agnostic mathematical operations M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide labels Feb 8, 2025
Copy link
Contributor

github-actions bot commented Feb 8, 2025

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Could you add some context on what users should update when this change get released in a new version of Bevy?
It will be used to help writing the migration guide for the version. Putting it after a ## Migration Guide will help it get automatically picked up by our tooling.

@mockersf mockersf added this pull request to the merge queue Feb 8, 2025
Merged via the queue into bevyengine:main with commit f3d8eb8 Feb 8, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants