pub struct AnimatedKeyframe { /* private fields */ }Expand description
A keyframe animation that automatically registers with the scheduler
Provides timed animations with easing functions between keyframes. The animation is automatically registered and ticked by the scheduler.
§Example
ⓘ
use blinc_animation::{AnimatedKeyframe, Keyframe, Easing};
// Create a keyframe animation
let mut anim = AnimatedKeyframe::new(ctx.animation_handle(), 1000); // 1 second
// Add keyframes
anim.keyframe(0.0, 0.0, Easing::Linear); // Start at 0
anim.keyframe(0.5, 100.0, Easing::EaseOut); // Middle at 100
anim.keyframe(1.0, 50.0, Easing::EaseInOut); // End at 50
// Start the animation
anim.start();
// Get current value (updated by scheduler)
let value = anim.get();Implementations§
Source§impl AnimatedKeyframe
impl AnimatedKeyframe
Sourcepub fn new(handle: SchedulerHandle, duration_ms: u32) -> AnimatedKeyframe
pub fn new(handle: SchedulerHandle, duration_ms: u32) -> AnimatedKeyframe
Create a new keyframe animation with the given duration
Sourcepub fn keyframe(self, time: f32, value: f32, easing: Easing) -> AnimatedKeyframe
pub fn keyframe(self, time: f32, value: f32, easing: Easing) -> AnimatedKeyframe
Add a keyframe at the given time position (0.0 to 1.0)
Sourcepub fn auto_start(self, auto: bool) -> AnimatedKeyframe
pub fn auto_start(self, auto: bool) -> AnimatedKeyframe
Set whether to auto-start when registered
Sourcepub fn iterations(self, count: i32) -> AnimatedKeyframe
pub fn iterations(self, count: i32) -> AnimatedKeyframe
Set number of iterations (-1 for infinite)
Sourcepub fn loop_infinite(self) -> AnimatedKeyframe
pub fn loop_infinite(self) -> AnimatedKeyframe
Enable infinite looping
Sourcepub fn ping_pong(self, enabled: bool) -> AnimatedKeyframe
pub fn ping_pong(self, enabled: bool) -> AnimatedKeyframe
Enable ping-pong mode (reverse direction on each iteration)
Sourcepub fn delay(self, delay_ms: u32) -> AnimatedKeyframe
pub fn delay(self, delay_ms: u32) -> AnimatedKeyframe
Set delay before animation starts (in milliseconds)
Sourcepub fn build(self) -> AnimatedKeyframe
pub fn build(self) -> AnimatedKeyframe
Build and register the animation, returning self for chaining
Sourcepub fn is_playing(&mut self) -> bool
pub fn is_playing(&mut self) -> bool
Check if the animation is playing (including during delay and looping)
Trait Implementations§
Source§impl Clone for AnimatedKeyframe
impl Clone for AnimatedKeyframe
Source§fn clone(&self) -> AnimatedKeyframe
fn clone(&self) -> AnimatedKeyframe
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AnimatedKeyframe
impl RefUnwindSafe for AnimatedKeyframe
impl Send for AnimatedKeyframe
impl Sync for AnimatedKeyframe
impl Unpin for AnimatedKeyframe
impl UnsafeUnpin for AnimatedKeyframe
impl UnwindSafe for AnimatedKeyframe
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.