Struct ark_api::world::AnimationBuilder
source · [−]pub struct AnimationBuilder<T> { /* private fields */ }
Expand description
An AnimationBuilder
is used to build an animation for a component value.
Set options on it such as curve / easing type, delay, target and finally submit the 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.
Implementations
sourceimpl<T> AnimationBuilder<T> where
ValueConverter: ValueConverterTrait<T>,
impl<T> AnimationBuilder<T> where
ValueConverter: ValueConverterTrait<T>,
sourcepub fn new(accessor: &ValueAccessorReadWriteAnimate<T>) -> Self
pub fn new(accessor: &ValueAccessorReadWriteAnimate<T>) -> Self
Creates an AnimationBuilder
from a ValueAccessor
.
sourcepub fn delay(&mut self, seconds: f32) -> &mut Self
pub fn delay(&mut self, seconds: f32) -> &mut Self
Sets the delay of the animation (how long to wait before it starts)
sourcepub fn target(&mut self, target: T, duration: f32) -> &mut Self
pub fn target(&mut self, target: T, duration: f32) -> &mut Self
Sets the target
value that the animated value will approach.
sourcepub fn curve(&mut self, curve: AnimationCurve) -> &mut Self
pub fn curve(&mut self, curve: AnimationCurve) -> &mut Self
Sets the curve shape of the value animation.
sourcepub fn loop_count(&mut self, loop_count: u32) -> &mut Self
pub fn loop_count(&mut self, loop_count: u32) -> &mut Self
Sets the number of times the animation will loop. 0 is currently undefined.
sourcepub fn smoothing(&mut self, smoothing: f32) -> &mut Self
pub fn smoothing(&mut self, smoothing: f32) -> &mut Self
Sets the method of smoothing when the animation target changes.
sourcepub fn enqueue(&mut self) -> &mut Self
pub fn enqueue(&mut self) -> &mut Self
Enqueues the animation instead of cancelling a currently on-going animation (if any).
sourcepub fn submit_messenger(
&self,
callback: Option<Box<dyn FnMut(&AnimationReplyType) + 'static>>
)
pub fn submit_messenger(
&self,
callback: Option<Box<dyn FnMut(&AnimationReplyType) + 'static>>
)
Finalizes the animation.
Also gives you the opportunity to pass in a callback
that will be called
once the animation is finished. For this to work, you must call entity_messenger().process_messages()
from your world_update
function.
Trait Implementations
sourceimpl<T> Deref for AnimationBuilder<T> where
ValueConverter: ValueConverterTrait<T>,
impl<T> Deref for AnimationBuilder<T> where
ValueConverter: ValueConverterTrait<T>,
type Target = AnimationRequest
type Target = AnimationRequest
The resulting type after dereferencing.
Auto Trait Implementations
impl<T> RefUnwindSafe for AnimationBuilder<T> where
T: RefUnwindSafe,
impl<T> Send for AnimationBuilder<T> where
T: Send,
impl<T> Sync for AnimationBuilder<T> where
T: Sync,
impl<T> Unpin for AnimationBuilder<T> where
T: Unpin,
impl<T> UnwindSafe for AnimationBuilder<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