pub struct AnimTrack {
pub name: String,
pub interp: TrackInterp,
/* private fields */
}Expand description
A named animation track holding keyframes for one parameter.
Fields§
§name: StringTrack name (identifies the morph parameter).
interp: TrackInterpInterpolation mode used when evaluating between keyframes.
Implementations§
Source§impl AnimTrack
impl AnimTrack
Sourcepub fn new(name: impl Into<String>, interp: TrackInterp) -> Self
pub fn new(name: impl Into<String>, interp: TrackInterp) -> Self
Create a new empty track with the given name and interpolation mode.
Sourcepub fn add_keyframe(&mut self, time: f32, value: f32)
pub fn add_keyframe(&mut self, time: f32, value: f32)
Add a keyframe at time with value.
Keyframes are kept sorted by time; if a keyframe at the exact time already
exists its value is replaced.
Sourcepub fn remove_keyframe(&mut self, time: f32) -> bool
pub fn remove_keyframe(&mut self, time: f32) -> bool
Remove the keyframe whose time exactly matches time.
Returns true if a keyframe was removed.
Sourcepub fn keyframe_count(&self) -> usize
pub fn keyframe_count(&self) -> usize
Number of keyframes in this track.
Sourcepub fn evaluate(&self, time: f32) -> f32
pub fn evaluate(&self, time: f32) -> f32
Evaluate the track at time using the configured interpolation mode.
Sourcepub fn set_interp(&mut self, interp: TrackInterp)
pub fn set_interp(&mut self, interp: TrackInterp)
Change the interpolation mode for this track.
Auto Trait Implementations§
impl Freeze for AnimTrack
impl RefUnwindSafe for AnimTrack
impl Send for AnimTrack
impl Sync for AnimTrack
impl Unpin for AnimTrack
impl UnsafeUnpin for AnimTrack
impl UnwindSafe for AnimTrack
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> 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>
Converts
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>
Converts
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