pub struct AnimationSystem { /* private fields */ }Expand description
Animation system for managing widget animations.
Implementations§
Source§impl AnimationSystem
impl AnimationSystem
Sourcepub fn animate(&mut self, widget_id: WidgetId, animation: Animation)
pub fn animate(&mut self, widget_id: WidgetId, animation: Animation)
Add an animation for a widget.
Sourcepub fn remove_animation(
&mut self,
widget_id: WidgetId,
property: AnimatableProperty,
)
pub fn remove_animation( &mut self, widget_id: WidgetId, property: AnimatableProperty, )
Remove an animation for a widget.
Sourcepub fn remove_widget_animations(&mut self, widget_id: WidgetId)
pub fn remove_widget_animations(&mut self, widget_id: WidgetId)
Remove all animations for a widget.
Sourcepub fn get_animations(&self, widget_id: WidgetId) -> Option<&WidgetAnimations>
pub fn get_animations(&self, widget_id: WidgetId) -> Option<&WidgetAnimations>
Get animations for a widget.
Sourcepub fn get_animations_mut(
&mut self,
widget_id: WidgetId,
) -> Option<&mut WidgetAnimations>
pub fn get_animations_mut( &mut self, widget_id: WidgetId, ) -> Option<&mut WidgetAnimations>
Get mutable animations for a widget.
Sourcepub fn animated_values(
&self,
) -> HashMap<WidgetId, HashMap<AnimatableProperty, f32>>
pub fn animated_values( &self, ) -> HashMap<WidgetId, HashMap<AnimatableProperty, f32>>
Get all animated widget values.
Returns a map of widget IDs to their animated property values.
Sourcepub fn widget_count(&self) -> usize
pub fn widget_count(&self) -> usize
Get the number of animated widgets.
Sourcepub fn has_active(&self) -> bool
pub fn has_active(&self) -> bool
Returns true if any animations are currently running.
Sourcepub fn tick(&mut self, delta_time: f32, ui: &mut UiCore)
pub fn tick(&mut self, delta_time: f32, ui: &mut UiCore)
Tick all animations by delta time and apply values to the UI.
This combines update() with automatic application of animated values
to the UI system via update_opacity, update_translate_x/y, update_scale_x/y.
Call once per frame in the update loop:
fn update(&mut self, ctx: &mut AppCtx) {
let dt = ctx.delta_time();
self.animations.tick(dt, &mut self.ui);
}Sourcepub fn tick_system(&mut self, delta_time: f32, ui: &mut UiSystem)
pub fn tick_system(&mut self, delta_time: f32, ui: &mut UiSystem)
Tick all animations by delta time and apply values to the UI system.
Convenience method that works with UiSystem instead of UiCore.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnimationSystem
impl RefUnwindSafe for AnimationSystem
impl Send for AnimationSystem
impl Sync for AnimationSystem
impl Unpin for AnimationSystem
impl UnsafeUnpin for AnimationSystem
impl UnwindSafe for AnimationSystem
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
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more