pub struct Animated {
pub value: f64,
pub keys: Vec<Keyframe>,
}Expand description
A scalar property that is either constant (value) or keyframed (keys, sorted by t).
Fields§
§value: f64§keys: Vec<Keyframe>Implementations§
Source§impl Animated
impl Animated
pub fn new(value: f64) -> Self
pub fn is_animated(&self) -> bool
pub fn is_default(&self, def: f64) -> bool
Sourcepub fn at(&self, t: f64) -> f64
pub fn at(&self, t: f64) -> f64
Value at clip-local time t (eased interpolation, clamped at the ends).
pub fn key_index_at(&self, t: f64) -> Option<usize>
pub fn has_key_at(&self, t: f64) -> bool
fn insert(&mut self, t: f64, v: f64)
Sourcepub fn set_at(&mut self, t: f64, v: f64)
pub fn set_at(&mut self, t: f64, v: f64)
Set the value at time t: upserts a keyframe when animated, otherwise sets the constant.
Sourcepub fn toggle_key(&mut self, t: f64)
pub fn toggle_key(&mut self, t: f64)
Add a keyframe at t holding the current value, or remove the one already there.
Sourcepub fn clear_keys(&mut self, t: f64)
pub fn clear_keys(&mut self, t: f64)
Remove all keyframes, keeping the value at t.
Sourcepub fn shift(&mut self, dt: f64)
pub fn shift(&mut self, dt: f64)
Shift all keyframe times by dt (used when trimming/splitting).
Sourcepub fn move_key(&mut self, i: usize, new_t: f64) -> usize
pub fn move_key(&mut self, i: usize, new_t: f64) -> usize
Move key i to new_t (keeps keys sorted); returns its new index.
Move key i to new_t, keeping the list sorted. A key already sitting at new_t is replaced
(dragging one keyframe onto another merges them instead of stacking duplicates).
pub fn set_ease_at(&mut self, t: f64, ease: Ease)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Animated
impl<'de> Deserialize<'de> for Animated
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Animated
Auto Trait Implementations§
impl Freeze for Animated
impl RefUnwindSafe for Animated
impl Send for Animated
impl Sync for Animated
impl Unpin for Animated
impl UnwindSafe for Animated
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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