bevy/crates/bevy_math/src
Rob Parrett f3d8eb8956
Fix rounding in steps easing function (#17743)
# Objective

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


![image](https://github.com/user-attachments/assets/be8f07e4-2079-461f-8c23-56d4b689aed9)

Comparing to the options available in
[css](https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/steps#description):


![image](https://github.com/user-attachments/assets/2c351519-c87f-483f-b5ff-63a9ee7b7b51)

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.

<img width="100" alt="image"
src="https://github.com/user-attachments/assets/1ec46270-72f2-4227-87e4-03de881548ab"
/>


## 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

<!-- Note to editors: this should be adjusted if 17744 is addressed, and
possibly combined with the notes from the PR that fixes it. -->

`EaseFunction::Steps` now behaves like css's default, "jump-end." If you
were relying on the old behavior, we plan on providing it. See
https://github.com/bevyengine/bevy/issues/17744.
2025-02-08 18:33:46 +00:00
..
bounding Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
cubic_splines Remove Implicit std Prelude from no_std Crates (#17086) 2025-01-03 01:58:43 +00:00
curve Fix rounding in steps easing function (#17743) 2025-02-08 18:33:46 +00:00
primitives Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
rects Add no_std Support to bevy_math (#15810) 2024-12-03 17:14:51 +00:00
sampling Prefer Display over Debug (#16112) 2024-12-27 00:40:06 +00:00
affine3.rs
aspect_ratio.rs Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
common_traits.rs Use variadics_please to implement StableInterpolate on tuples. (#16931) 2024-12-24 02:53:43 +00:00
compass.rs Add basic directional (gamepad) navigation for UI (and non-UI) (#17102) 2025-01-06 18:51:44 +00:00
direction.rs Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00
float_ord.rs bevy_math: Apply #[deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17091) 2025-01-02 18:47:36 +00:00
isometry.rs
lib.rs Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
ops.rs bevy_math: Apply #[deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17091) 2025-01-02 18:47:36 +00:00
ray.rs Add no_std Support to bevy_math (#15810) 2024-12-03 17:14:51 +00:00
rotation2d.rs Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00