Struct ark_api::world::ValueAccessorReadWriteAnimate
source · [−]pub struct ValueAccessorReadWriteAnimate<T> { /* private fields */ }
Expand description
A ValueAccessor
is used to set/get/animate a component value.
bool
and i64
types will be set to target directly when using animate
.
Example:
let ball_mesh = ...;
let ball_entity = Entity::create("ball");
ball_entity.render().mesh().set(ball_mesh);
ball_entity
.transform()
.position() // ValueAccessor returned here
.set(Vec3::ZERO);
let duration = 1.0; // Duration is in seconds
ball_entity
.transform()
.position() // ValueAccessor returned here
.animate(Vec3::new(0.0, 2.5, -40.0), duration);
Implementations
sourceimpl<T> ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
impl<T> ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
sourcepub fn new(id: Entity, component: ComponentType, param: u32) -> Self where
T: Sized,
pub fn new(id: Entity, component: ComponentType, param: u32) -> Self where
T: Sized,
Create a new value accessor for a specific entity, component and parameter.
sourcepub fn animate(&self, v: T, duration: f32)
pub 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.
sourcepub fn animate_smooth(&self, v: T, duration: f32, smoothing: f32)
pub 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.
sourcepub fn build_animation(&self) -> AnimationBuilder<T>
pub fn build_animation(&self) -> AnimationBuilder<T>
Starts setting up an animation of this value.
Call methods on the returned AnimationBuilder
to configure it.
Trait Implementations
sourceimpl<T> ValueAccessorAnimateTrait<T> for ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
impl<T> ValueAccessorAnimateTrait<T> for ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
Implementation of trait for animating component values
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.
sourceimpl<T> ValueAccessorReadTrait<T> for ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
impl<T> ValueAccessorReadTrait<T> for ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
Implementation of trait for reading component values
sourceimpl<T> ValueAccessorWriteTrait<T> for ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
impl<T> ValueAccessorWriteTrait<T> for ValueAccessorReadWriteAnimate<T> where
ValueConverter: ValueConverterTrait<T>,
Implementation of trait for writing component values
Auto Trait Implementations
impl<T> RefUnwindSafe for ValueAccessorReadWriteAnimate<T> where
T: RefUnwindSafe,
impl<T> Send for ValueAccessorReadWriteAnimate<T> where
T: Send,
impl<T> Sync for ValueAccessorReadWriteAnimate<T> where
T: Sync,
impl<T> Unpin for ValueAccessorReadWriteAnimate<T> where
T: Unpin,
impl<T> UnwindSafe for ValueAccessorReadWriteAnimate<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more