Trait ark_api::world::ValueAccessorAnimateTrait
source · pub trait ValueAccessorAnimateTrait<T>where
ValueConverter: ValueConverterTrait<T>,{
// Required methods
fn animate(&self, v: T, duration: f32);
fn animate_smooth(&self, v: T, duration: f32, smoothing: f32);
fn build_animation(&self) -> AnimationBuilder<T>;
}Expand description
Trait for animating component values
Required Methods§
sourcefn animate(&self, v: T, duration: f32)
fn animate(&self, v: T, duration: f32)
Will linearly animate / transition the value from the current value to the
target v using duration (in seconds).
Will stop and continue from any ongoing animation.
Note: bools and integers (also all kinds of entity references) will be set to their target directly, however delay can be used to delay the set of the value.
sourcefn animate_smooth(&self, v: T, duration: f32, smoothing: f32)
fn animate_smooth(&self, v: T, duration: f32, smoothing: f32)
Will linearly animate / transition the value from the current value to the
Will stop and continue from any ongoing animation. A smoothing constant of 0 means no smoothing, higher value means more smoothing (i.e. the value will take a longer time to change).
Useful if you want to smoothen out discontinuities when animating to new targets, cancelling the old animation.
Note: bools and integers (also all kinds of entity references) will be set to their target directly, however delay can be used to delay the set of the value.
sourcefn build_animation(&self) -> AnimationBuilder<T>
fn build_animation(&self) -> AnimationBuilder<T>
Starts setting up an animation of this value.
Call methods on the returned AnimationBuilder to configure it.
Implementors§
impl<T> ValueAccessorAnimateTrait<T> for ValueAccessorReadWriteAnimate<T>where ValueConverter: ValueConverterTrait<T>,
Implementation of trait for animating component values