pub enum Animated<T> {
Constant {
value: T,
},
Keyframes {
keyframes: Vec<Keyframe<T>>,
before: Extrapolation,
after: Extrapolation,
},
Split {
channels: Vec<Animated<f32>>,
},
Data(Box<DataBinding>),
}Expand description
A value that is constant, controlled by sorted keyframes, split into one animated number per component, or following a data set.
Only value types whose AnimatedValue::ACCEPTS_DATA is true (f32, Vec2 and
crate::EffectValue) read or offer the data mode, and only those with an
AnimatedValue::SPLIT (Vec2 and crate::EffectValue) the split mode; for the
others the mode fails to deserialize and the schema leaves it out.
Variants§
Constant
A value without animation.
Fields
value: TValue used at every timestamp.
Keyframes
Values evaluated from their keyframe sequence.
Fields
before: ExtrapolationWhat the value does before the first keyframe.
after: ExtrapolationWhat the value does after the last keyframe.
Split
One animated number per component, each with its own keyframes, curves and extrapolation, or its own data binding.
Fields
Data(Box<DataBinding>)
A channel of a data set, followed at render time.
Implementations§
Source§impl<T> Animated<T>
impl<T> Animated<T>
Sourcepub const fn keyed(keyframes: Vec<Keyframe<T>>) -> Self
pub const fn keyed(keyframes: Vec<Keyframe<T>>) -> Self
A value controlled by keyframes, holding before the first and after the last.
Sourcepub fn map<U>(&self, map: impl Fn(&T) -> U) -> Animated<U>
pub fn map<U>(&self, map: impl Fn(&T) -> U) -> Animated<U>
The same animation with each value mapped by map, keeping times, interpolations and
extrapolation.
Sourcepub const fn data(&self) -> Option<&DataBinding>
pub const fn data(&self) -> Option<&DataBinding>
The data binding, when the whole value follows a data set. A split value’s channels
hold their own.
Trait Implementations§
Source§impl<'de, T: Deserialize<'de> + AnimatedValue> Deserialize<'de> for Animated<T>
impl<'de, T: Deserialize<'de> + AnimatedValue> Deserialize<'de> for Animated<T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl<T: PartialEq> StructuralPartialEq for Animated<T>
Source§impl<T> TimelineValue for Animated<T>
impl<T> TimelineValue for Animated<T>
Source§fn keep_window(&mut self, window: (i64, i64))
fn keep_window(&mut self, window: (i64, i64))
window (ticks, end exclusive): those
inside it and the nearest one on each side, or all of them when the window reaches past
an end the value does not hold at.Source§fn via_clips(&self, visit: &mut dyn FnMut(&ClipId))
fn via_clips(&self, visit: &mut dyn FnMut(&ClipId))
visit with each clip a data binding of the value reads through: the value’s own
binding, or those of its split channels.Source§fn via_clips_mut(&mut self, visit: &mut dyn FnMut(&mut ClipId))
fn via_clips_mut(&mut self, visit: &mut dyn FnMut(&mut ClipId))
Self::via_clips, to point them at other clips.