Skip to main content

Track

Enum Track 

Source
pub enum Track<T> {
    Const(T),
    Keys(Vec<Key<T>>),
    Expr(Vec<Compiled>),
    KeysExpr(Vec<Key<T>>, Vec<Compiled>),
    Sampled(Vec<T>),
}
Expand description

A parameter: a constant, keyframes, an expression per component, or an expression over its own keys (value).

Variants§

§

Const(T)

§

Keys(Vec<Key<T>>)

Sorted by t; held before the first and after the last.

§

Expr(Vec<Compiled>)

One per component.

§

KeysExpr(Vec<Key<T>>, Vec<Compiled>)

An expression per component over its own keys (value).

§

Sampled(Vec<T>)

Per frame, from the range’s first frame (internal: exact lowering).

Implementations§

Source§

impl<T: Animatable> Track<T>

Source

pub fn parse(v: &Value, clock: Clock, what: &str) -> Result<Self>

A constant, keys, an expression string (N = 1), an array of N constants or expressions, or {"keys": [...], "expr": ...}. what names the parameter in errors.

Source

pub fn parse_in(v: &Value, scope: &Scope<'_>, what: &str) -> Result<Self>

Track::parse against scope (its clock and vars).

Source

pub fn from_keys(keys: Vec<Key<T>>) -> Self

Keys in any order (sorted here, stable for equal times).

Source

pub fn is_animated(&self) -> bool

Whether the value can change from frame to frame.

Source

pub fn keys(&self) -> Option<&[Key<T>]>

The keys, if keyframed.

Source

pub fn try_eval(&self, clock: Clock, frame: &Frame<'_>) -> Result<Option<T>>

The value on frame, None for empty keys; an error if an expression isn’t finite. Sampled reads frame’s n.

Source

pub fn eval(&self, frame: &Frame<'_>) -> Result<T>

The value on frame, keys on Clock::Layer (lt).

Source

pub fn at(&self, clock: Clock, t: f64, dur: f64) -> Option<T>

The value at t on clock when only that time is known (timeline effects), None for empty keys or a non-finite expression.

Source

pub fn sample( &self, clock: Clock, frames: Range<i64>, env: &Env<'_>, ) -> Result<Vec<T>>

The values on frames in env (vars evaluated per frame). Sampled tracks index from the range’s start.

Trait Implementations§

Source§

impl<T: Clone> Clone for Track<T>

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<T: Debug> Debug for Track<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for Track<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: PartialEq> PartialEq for Track<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq> StructuralPartialEq for Track<T>

Auto Trait Implementations§

§

impl<T> Forget for Track<T>

§

impl<T> Freeze for Track<T>
where T: Freeze, Vec<Key<T>>: Freeze, Vec<T>: Freeze,

§

impl<T> RefUnwindSafe for Track<T>

§

impl<T> Send for Track<T>
where T: Send, Vec<Key<T>>: Send, Vec<T>: Send,

§

impl<T> Sync for Track<T>
where T: Sync, Vec<Key<T>>: Sync, Vec<T>: Sync,

§

impl<T> Unpin for Track<T>
where T: Unpin, Vec<Key<T>>: Unpin, Vec<T>: Unpin,

§

impl<T> UnsafeUnpin for Track<T>

§

impl<T> UnwindSafe for Track<T>
where T: UnwindSafe, Vec<Key<T>>: UnwindSafe, Vec<T>: UnwindSafe,

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.