Struct rusty_spine::TrackEntry
source · pub struct TrackEntry { /* private fields */ }
Expand description
Stores settings and other state for the playback of an animation on an AnimationState
track.
Implementations§
source§impl TrackEntry
impl TrackEntry
sourcepub fn animation_time(&self) -> f32
pub fn animation_time(&self) -> f32
Uses track_time
to compute the
animation_time
. When the track_time
is
0, the animation_time
is equal to the
animation_start
time.
The animation_time
is between
animation_start
and
animation_end
, except if this track entry is non-looping and
animation_end
is >= to the animation duration, then
animation_time
continues to increase past
animation_end
.
sourcepub fn track_complete(&self) -> f32
pub fn track_complete(&self) -> f32
If this track entry is non-looping, the track time in seconds when
animation_end
is reached, or the current
track_time
if it has already been reached. If this track entry is
looping, the track time when this animation will reach its next
animation_end
(the next loop completion).
sourcepub fn animation(&self) -> CTmpRef<'_, Self, Animation>
pub fn animation(&self) -> CTmpRef<'_, Self, Animation>
The animation to apply for this track entry.
sourcepub fn animation_mut(&mut self) -> CTmpMut<'_, Self, Animation>
pub fn animation_mut(&mut self) -> CTmpMut<'_, Self, Animation>
The mutable animation to apply for this track entry.
sourcepub fn previous(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
pub fn previous(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
The animation queued to play before this animation, or None
. previous
makes up a
doubly linked list.
sourcepub fn next(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
pub fn next(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
The animation queued to start after this animation, or None
if there is none. next
makes up a doubly linked list.
See AnimationState::clear_next
to truncate the list.
sourcepub fn mixing_from(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
pub fn mixing_from(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
The track entry for the previous animation when mixing from the previous animation to this
animation, or None
if no mixing is currently occuring. When mixing from multiple
animations, mixing_from
makes up a linked list.
sourcepub fn mixing_to(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
pub fn mixing_to(&self) -> Option<CTmpRef<'_, Self, TrackEntry>>
The track entry for the next animation when mixing from this animation to the next
animation, or None
if no mixing is currently occuring. When mixing to multiple
animations, mixing_to
makes up a linked list.
pub fn track_index(&self) -> usize
sourcepub fn looping(&self) -> bool
pub fn looping(&self) -> bool
If true
, the animation will repeat. If false
it will not, instead its last frame is
applied if played beyond its duration.
sourcepub fn set_looping(&mut self, value: bool)
pub fn set_looping(&mut self, value: bool)
Set looping, see looping
.
sourcepub fn hold_previous(&self) -> bool
pub fn hold_previous(&self) -> bool
If true
, when mixing from the previous animation to this animation, the previous
animation is applied as normal instead of being mixed out.
When mixing between animations that key the same property, if a lower track also keys
that property then the value will briefly dip toward the lower track value during the
mix. This happens because the first animation mixes from 100% to 0% while the second
animation mixes from 0% to 100%. Setting hold_previous
to true applies the first
animation at 100% during the mix so the lower track value is overwritten. Such dipping
does not occur on the lowest track which keys the property, only when a higher track
also keys the property.
Snapping will occur if hold_previous
is true and this animation does not key all the
same properties as the previous animation.
sourcepub fn set_hold_previous(&mut self, value: bool)
pub fn set_hold_previous(&mut self, value: bool)
Set hold previous, see hold_previous
.
sourcepub fn reverse(&self) -> bool
pub fn reverse(&self) -> bool
If true
, the animation will be applied in reverse. Events are not fired when an
animation is applied in reverse.
sourcepub fn set_reverse(&mut self, value: bool)
pub fn set_reverse(&mut self, value: bool)
Set reverse, see reverse
.
sourcepub fn shortest_rotation(&self) -> bool
pub fn shortest_rotation(&self) -> bool
If true
, mixing rotation between tracks always uses the shortest rotation direction.
If the rotation is animated, the shortest rotation direction may change during the mix.
If false
, the shortest rotation direction is remembered when the mix starts and the
same direction is used for the rest of the mix.
Defaults to false
.
sourcepub fn set_shortest_rotation(&mut self, value: bool)
pub fn set_shortest_rotation(&mut self, value: bool)
Set shortest rotation, see shortest_rotation
.
sourcepub fn event_threshold(&self) -> f32
pub fn event_threshold(&self) -> f32
When the mix percentage (mix_time
/
mix_duration
) is less than the event_threshold
, event
timelines are applied while this animation is being mixed out. Defaults to 0, so event
timelines are not applied while this animation is being mixed out.
sourcepub fn set_event_threshold(&mut self, value: f32)
pub fn set_event_threshold(&mut self, value: f32)
Set the event threshold, see event_threshold
.
sourcepub fn attachment_threshold(&self) -> f32
pub fn attachment_threshold(&self) -> f32
When the mix percentage (mix_time
/
mix_duration
) is less than the attachment_threshold
,
attachment timelines are applied while this animation is being mixed out. Defaults to 0,
so attachment timelines are not applied while this animation is being mixed out.
sourcepub fn set_attachment_threshold(&mut self, value: f32)
pub fn set_attachment_threshold(&mut self, value: f32)
Set the attachment threshold, see
attachment_threshold
.
sourcepub fn draw_order_threshold(&self) -> f32
pub fn draw_order_threshold(&self) -> f32
When the mix percentage (mix_time
/
mix_duration
) is less than the draw_order_threshold
, draw
order timelines are applied while this animation is being mixed out. Defaults to 0, so
draw order timelines are not applied while this animation is being mixed out.
sourcepub fn set_draw_order_threshold(&mut self, value: f32)
pub fn set_draw_order_threshold(&mut self, value: f32)
Set the draw order threshold, see
draw_order_threshold
.
sourcepub fn animation_start(&self) -> f32
pub fn animation_start(&self) -> f32
Seconds when this animation starts, both initially and after looping. Defaults to 0.
When changing the animationStart time, it often makes sense to set
animation_last
to the same value to prevent timeline keys
before the start time from triggering.
sourcepub fn set_animation_start(&mut self, value: f32)
pub fn set_animation_start(&mut self, value: f32)
Set the animation start, see animation_start
.
sourcepub fn animation_end(&self) -> f32
pub fn animation_end(&self) -> f32
Seconds for the last frame of this animation. Non-looping animations won’t play past
this time. Looping animations will loop back to
animation_start
at this time. Defaults to the animation
duration.
sourcepub fn set_animation_end(&mut self, value: f32)
pub fn set_animation_end(&mut self, value: f32)
Set the animation end, see animation_end
.
sourcepub fn animation_last(&self) -> f32
pub fn animation_last(&self) -> f32
The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this animation is applied, event timelines will fire all events between the animationLast time (exclusive) and animationTime (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation is applied.
sourcepub fn set_animation_last(&mut self, value: f32)
pub fn set_animation_last(&mut self, value: f32)
Set the animation last, see animation_last
.
sourcepub fn delay(&self) -> f32
pub fn delay(&self) -> f32
Seconds to postpone playing the animation. When this track entry is the current track
entry, delay postpones incrementing the track_time
. When this
track entry is queued, delay is the time from the start of the previous animation to
when this track entry will become the current track entry (ie when the previous track
entry track_time
>= this track entry’s delay).
timescale
affects the delay.
When using addAnimation with a delay <= 0, the delay is set using the mix duration from the AnimationStateData. If mixDuration is set afterward, the delay may need to be adjusted.
sourcepub fn track_time(&self) -> f32
pub fn track_time(&self) -> f32
Current time in seconds this track entry has been the current track entry. The track
time determines animation_time
. The track time can be set
to start the animation at a time other than 0, without affecting looping.
sourcepub fn track_end(&self) -> f32
pub fn track_end(&self) -> f32
The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the properties keyed by the animation are set to the setup pose and the track is cleared.
It may be desired to use AnimationState::add_empty_animation
rather than have the
animation abruptly cease being applied.
sourcepub fn set_track_end(&mut self, value: f32)
pub fn set_track_end(&mut self, value: f32)
Set the track end, see track_end
.
sourcepub fn timescale(&self) -> f32
pub fn timescale(&self) -> f32
Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or faster. Defaults to 1.
Values < 0 are not supported. To play an animation in reverse, use
set_reverse
.
mix_time
is not affected by track entry time scale, so
mix_duration
may need to be adjusted to match the animation
speed.
When using AnimationState::add_animation
with a delay <= 0, the delay is set using
the mix duration from the AnimationStateData
, assuming time scale to be 1. If the
time scale is not 1, the delay may need to be adjusted.
See AnimationState::timescale
for affecting all animations.
sourcepub fn set_timescale(&mut self, value: f32)
pub fn set_timescale(&mut self, value: f32)
Set the timescale, see timescale
.
sourcepub fn alpha(&self) -> f32
pub fn alpha(&self) -> f32
Values < 1 mix this animation with the skeleton’s current pose (usually the pose resulting from lower tracks). Defaults to 1, which overwrites the skeleton’s current pose with this animation.
Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn’t make sense to use alpha on track 0 if the skeleton pose is from the last frame render.
sourcepub fn mix_time(&self) -> f32
pub fn mix_time(&self) -> f32
Seconds from 0 to the mix_duration
when mixing from the
previous animation to this animation. May be slightly more than
mix_duration
when the mix is complete.
sourcepub fn set_mix_time(&mut self, value: f32)
pub fn set_mix_time(&mut self, value: f32)
Set the mix time, see mix_time
.
sourcepub fn mix_duration(&self) -> f32
pub fn mix_duration(&self) -> f32
Seconds for mixing from the previous animation to this animation. Defaults to the value
provided by AnimationStateData::get_mix
based on the animation before this animation
(if any).
A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the properties it was animating.
The mixDuration can be set manually rather than use the value from
AnimationStateData::get_mix
. In that case, the
mix_duration
can be set for a new track entry only before
update is first called.
When using AnimationState::add_animation
with a delay <= 0
, the
delay
is set using the mix duration from the AnimationStateData
.
If mix_duration
is set afterward, the delay may need to be adjusted.
For example:
entry.set_delay(entry.previous().unwrap().track_complete() - entry.mix_duration());
sourcepub fn set_mix_duration(&mut self, value: f32)
pub fn set_mix_duration(&mut self, value: f32)
Set the mix duration, see mix_duration
.
pub fn total_alpha(&self) -> f32
pub fn renderer_object(&self) -> RendererObject<'_>
sourcepub const fn c_ptr(&self) -> *mut spTrackEntry
pub const fn c_ptr(&self) -> *mut spTrackEntry
Get a pointer to the underlying spine-c
type.