Struct rusty_spine::AnimationState
source · pub struct AnimationState { /* private fields */ }
Expand description
The live animation state for a skeleton, allowing animation layering and crossfading.
Implementations
sourceimpl AnimationState
impl AnimationState
pub fn new(animation_state_data: Arc<AnimationStateData>) -> Self
pub fn update(&mut self, delta: f32)
pub fn apply(&self, skeleton: &mut Skeleton) -> bool
sourcepub fn clear_tracks(&mut self)
pub fn clear_tracks(&mut self)
Clears all animations in all track entries in this animation state.
sourcepub fn clear_track(&mut self, track_index: i32)
pub fn clear_track(&mut self, track_index: i32)
Clears animations for the given track entry index in this animation state.
sourcepub unsafe fn set_animation_by_name_unchecked(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool
) -> CTmpMut<'_, Self, TrackEntry>
pub unsafe fn set_animation_by_name_unchecked(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool
) -> CTmpMut<'_, Self, TrackEntry>
Sets the animation for the given track by name, clearing any queued tracks, and returning the track index. If the track index doesn’t exist then it will be created.
Safety
This function should only be called with valid animation names. It is faster than the safe
alternative, AnimationState::set_animation_by_name
, but will likely segfault if the
animation does not exist.
sourcepub fn set_animation_by_name(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool
) -> Result<CTmpMut<'_, Self, TrackEntry>, SpineError>
pub fn set_animation_by_name(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool
) -> Result<CTmpMut<'_, Self, TrackEntry>, SpineError>
Sets the animation for the given track by name, clearing any queued tracks, and returning the track index. If the track index doesn’t exist then it will be created.
Errors
Returns SpineError::NotFound
if an animation doesn’t exist with the given name.
sourcepub fn set_animation(
&mut self,
track_index: i32,
animation: &Animation,
looping: bool
) -> CTmpMut<'_, Self, TrackEntry>
pub fn set_animation(
&mut self,
track_index: i32,
animation: &Animation,
looping: bool
) -> CTmpMut<'_, Self, TrackEntry>
Sets the animation for the given track, clearning any queued tracks, and returning the track index. If the track index doesn’t exist then it will be created.
sourcepub unsafe fn add_animation_by_name_unchecked(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool,
delay: f32
) -> CTmpMut<'_, Self, TrackEntry>
pub unsafe fn add_animation_by_name_unchecked(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool,
delay: f32
) -> CTmpMut<'_, Self, TrackEntry>
Queues the animation in the given track by name, returning the track index. If the track index doesn’t exist then it will be created.
Safety
This function should only be called with valid animation names. It is faster than the safe
alternative, AnimationState::add_animation_by_name
, but will likely segfault if the
animation does not exist.
sourcepub fn add_animation_by_name(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool,
delay: f32
) -> Result<CTmpMut<'_, Self, TrackEntry>, SpineError>
pub fn add_animation_by_name(
&mut self,
track_index: i32,
animation_name: &str,
looping: bool,
delay: f32
) -> Result<CTmpMut<'_, Self, TrackEntry>, SpineError>
Queues the animation in the given track by name, returning the track index. If the track index doesn’t exist then it will be created.
Errors
Returns SpineError::NotFound
if an animation doesn’t exist with the given name.
sourcepub fn add_animation(
&mut self,
track_index: i32,
animation: &Animation,
looping: bool,
delay: f32
) -> CTmpMut<'_, Self, TrackEntry>
pub fn add_animation(
&mut self,
track_index: i32,
animation: &Animation,
looping: bool,
delay: f32
) -> CTmpMut<'_, Self, TrackEntry>
Queues the animation in the given track, returning the track index. If the track index doesn’t exist then it will be created.
pub fn set_empty_animation(
&mut self,
track_index: i32,
mix_duration: f32
) -> CTmpMut<'_, Self, TrackEntry>
pub fn add_empty_animation(
&mut self,
track_index: i32,
mix_duration: f32,
delay: f32
) -> CTmpMut<'_, Self, TrackEntry>
pub fn set_empty_animations(&mut self, mix_duration: f32)
pub fn get_current(
&self,
track_index: i32
) -> Option<CTmpRef<'_, Self, TrackEntry>>
sourcepub fn set_listener<F>(&mut self, listener: F)where
F: Fn(&AnimationState, EventType, &TrackEntry, Option<&Event>) + 'static,
pub fn set_listener<F>(&mut self, listener: F)where
F: Fn(&AnimationState, EventType, &TrackEntry, Option<&Event>) + 'static,
Set the event listener on this animation state. An animation state can only have one event
listener at a time. See the documentation for Event
for more information.