Skip to main content

TrackEntry

Struct TrackEntry 

Source
pub struct TrackEntry {
Show 25 fields pub animation: AnimationId, pub track_index: usize, pub previous: Option<EntryId>, pub next: Option<EntryId>, pub mixing_from: Option<EntryId>, pub mixing_to: Option<EntryId>, pub looping: bool, pub additive: bool, pub reverse: bool, pub shortest_rotation: bool, pub event_threshold: f32, pub mix_attachment_threshold: f32, pub alpha_attachment_threshold: f32, pub mix_draw_order_threshold: f32, pub animation_start: f32, pub animation_end: f32, pub animation_last: f32, pub delay: f32, pub track_time: f32, pub track_end: f32, pub time_scale: f32, pub alpha: f32, pub mix_time: f32, pub mix_duration: f32, pub mix_interpolation: Interpolation, /* private fields */
}
Expand description

Playback of one animation on a track. Times are in seconds.

Get one from AnimationState::set_animation or AnimationState::add_animation and adjust its fields through AnimationState::entry_mut. The links (previous, next, mixing_from, mixing_to) are maintained by the state; read them, don’t write them.

Fields§

§animation: AnimationId

The animation played, or EMPTY_ANIMATION_ID.

§track_index: usize§previous: Option<EntryId>

The entry this one is queued after. None once this entry is current.

§next: Option<EntryId>

The entry queued to play after this one.

§mixing_from: Option<EntryId>

The entry this one is crossfading from.

§mixing_to: Option<EntryId>

The entry crossfading from this one.

§looping: bool

Repeats the animation between animation_start and animation_end.

§additive: bool

Adds this entry’s values to lower tracks instead of mixing toward them, for timelines that support it (Timeline::is_additive).

§reverse: bool

Plays the animation backward.

§shortest_rotation: bool

Mixes rotation the shortest way every frame. Otherwise the direction chosen on the first frame of a mix is kept, so a bone doesn’t flip direction mid-mix. Always on for additive entries.

§event_threshold: f32

While this entry mixes out, its keyframe events fire only while the mix percentage is below this. 0 (the default) suppresses them.

§mix_attachment_threshold: f32

While this entry mixes out, the attachments it keys are kept only while the mix percentage is below this. Default 0.

§alpha_attachment_threshold: f32

The attachments this entry keys are kept only while the alpha it applies with is at least this. Default 0.

§mix_draw_order_threshold: f32

While this entry mixes out, its draw order keys apply only while the mix percentage is below this. Default 0.

§animation_start: f32

Animation time at which playback starts. Default 0.

§animation_end: f32

Animation time at which playback ends or loops. Defaults to the animation’s duration.

§animation_last: f32

Animation time last applied, or -1 before the first apply. Set it with Self::set_animation_last; a direct write is overwritten by the next AnimationState::update.

§delay: f32

Seconds before the entry starts. For a queued entry, the previous entry’s track time at which this one becomes current.

§track_time: f32

Seconds this entry has played, scaled by time_scale.

§track_end: f32

Track time at which the entry ends if nothing is queued after it. Defaults to f32::MAX; empty animations end when their mix does.

§time_scale: f32

Multiplies the delta this entry advances by.

§alpha: f32

Weight of this entry over lower tracks, 0 to 1.

§mix_time: f32

Seconds into the crossfade from mixing_from.

§mix_duration: f32

Length of the crossfade from the previous entry. Taken from AnimationStateData::mix when the entry is created; 0 switches immediately.

§mix_interpolation: Interpolation

Implementations§

Source§

impl TrackEntry

Source

pub fn animation_time(&self) -> f32

Time within the animation: track time offset by animation_start, wrapped when looping and clamped to animation_end otherwise.

Source

pub fn set_animation_last(&mut self, value: f32)

Sets animation_last, the time events fire from on the next apply.

Source

pub fn is_complete(&self) -> bool

Whether track time has reached one full play of the animation.

Source

pub fn track_complete(&self) -> f32

Track time when the current loop or the animation completes.

Source

pub fn was_applied(&self) -> bool

Whether the entry has been applied at least once.

Source

pub fn is_empty_animation(&self) -> bool

Source

pub fn mix(&self) -> f32

Crossfade percentage after easing, 0..=1. 1 when there is no mix.

Source

pub fn reset_rotation_directions(&mut self)

Discards the rotation directions kept for mixing, so the next apply picks the shortest way again. Useful when alpha changes or animations start on other tracks, so bones don’t rotate the long way around.

Trait Implementations§

Source§

impl Clone for TrackEntry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TrackEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.