pub enum ControlSource {
Step(Vec<(u64, f64)>),
Linear(Vec<(u64, f64)>),
}Expand description
A keyframed value curve, sampled by PTS. Values are f64 regardless of the
property’s kind; the conversion to the property’s type happens at
apply.
Both variants clamp outside their keyframe range: before the first keyframe the first value holds, after the last one the last value holds.
Variants§
Step(Vec<(u64, f64)>)
Hold each keyframe’s value until the next keyframe’s time (a discrete knob: a mode switch, a boolean).
Linear(Vec<(u64, f64)>)
Interpolate linearly between the surrounding keyframes (a smooth pan, fade, or zoom).
Implementations§
Source§impl ControlSource
impl ControlSource
Sourcepub fn step(keys: impl IntoIterator<Item = (u64, f64)>) -> Self
pub fn step(keys: impl IntoIterator<Item = (u64, f64)>) -> Self
A step curve over keys ((pts_ns, value)), sorted here so the caller
need not supply them in order.
Sourcepub fn linear(keys: impl IntoIterator<Item = (u64, f64)>) -> Self
pub fn linear(keys: impl IntoIterator<Item = (u64, f64)>) -> Self
A linear curve over keys ((pts_ns, value)), sorted here.
Sourcepub fn value_at(&self, t_ns: u64) -> f64
pub fn value_at(&self, t_ns: u64) -> f64
The curve’s value at t_ns. Clamps to the end values outside the
keyframe range; 0.0 for a curve with no keyframes, which
ControlProgram::resolve rejects before a run can sample it.
Trait Implementations§
Source§impl Clone for ControlSource
impl Clone for ControlSource
Source§fn clone(&self) -> ControlSource
fn clone(&self) -> ControlSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more