mirror of
https://github.com/bevyengine/bevy
synced 2024-12-22 19:13:08 +00:00
602515d8aa
# Objective Allow animation of types other than translation, scale, and rotation on `Transforms`. ## Solution Add a base trait for all values that can be animated by the animation system. This provides the basic operations for sampling and blending animation values for more than just translation, rotation, and scale. This implements part of bevyengine/rfcs#51, but is missing the implementations for `Range<T>` and `Color`. This also does not fully integrate with the existing `AnimationPlayer` yet, just setting up the trait. --------- Co-authored-by: Kirillov Kirill <kirusfg@gmail.com> Co-authored-by: François <mockersf@gmail.com> Co-authored-by: irate <JustTheCoolDude@gmail.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
10 lines
241 B
Rust
10 lines
241 B
Rust
/// Steps between two different discrete values of any type.
|
|
/// Returns `a` if `t < 1.0`, otherwise returns `b`.
|
|
#[inline]
|
|
pub(crate) fn step_unclamped<T>(a: T, b: T, t: f32) -> T {
|
|
if t < 1.0 {
|
|
a
|
|
} else {
|
|
b
|
|
}
|
|
}
|