mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
59db6f9cca
# Objective Citing @mweatherley > There is a lot of shortfall for simple cases— e.g., we should have library functions for making a curve connecting two points, eased versions of that, and so on. ## Solution This PR implements - a simple `Easing` trait which is implemented for all `impl Curve<f32>` types. We can't really guarantee that these curves have unit interval domain, which some people would probably expect, but it is documented that this isn't the case for these types and we redirect to `EasingCurve` which is used for that purpose - an `EasingCurve` struct, which is used to interpolate between two values `start` and `end` using a `impl Easing` curve where the curve will be guaranteed to be reparametrized - a `LinearCurve` which linearly interpolates between two values `start` and `end` - a `CubicBezierCurve` which interpolates between `start` and `end` values using a `CubicSegment` - a `StepCurve` which interpolates between `start` and `end` with an step-function with `n` steps - an `ElasticCurve` which interpolates between `start` and `end` with spring like behavior where the elasticity of the spring is configurable - some `FunctionCurve` easing curves for different popular functions including: `quadratic_ease_in`, `quadratic_ease_out`, `smoothstep`, `identity` ## Testing - there are a few new tests for all of these in the main module --------- Co-authored-by: eckz <567737+eckz@users.noreply.github.com> Co-authored-by: Miles Silberling-Cook <NthTensor@users.noreply.github.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Matty <weatherleymatthew@gmail.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
clippy.toml | ||
README.md |