Skip to main content

InstanceSlot

Struct InstanceSlot 

Source
pub struct InstanceSlot { /* private fields */ }
Expand description

High-level instance-child slot: tracks the per-slot transition state. step() resolves labels against the child runtime context, configures the child’s playback (animation section, loop, direction), and advances the child’s frame — leaving only the C++/host-side play() event sink and the redraw call to the caller.

Implementations§

Source§

impl InstanceSlot

Source

pub const fn new() -> Self

Source

pub fn is_independent(&self) -> bool

Whether the slot is currently driving its child independently of the parent’s frame. Reflects the most recently seen EventInstance.independent.

Source

pub fn get_speed(&self) -> f32

The speed the most recent Self::step drove the child at, 1.0 before the first. Usually the key’s speed, but while the slot ignores the implicit frame-0 key it keeps the last real key’s, so the event the host resolved says 1.0 when the child is not running at it.

Scale the elapsed time handed to the child’s own instance and effect slots by its absolute value: the child’s sub-tree runs on the child’s clock. Scaling by the resolved event’s speed instead runs the grandchildren at the wrong rate every time the parent goes back before the first real key of an independent child.

Source

pub fn reset(&mut self)

Reset the slot’s “last started key” memory to its just-created state so the host can re-fire the instance child on an explicit head-out (play / replay) instead of debouncing the first key as the same one it last started. The child context is owned by the host and reset separately; the next step re-configures it on transition, and the host plays it.

Source

pub fn step( &mut self, ev: ss_event_instance_info, child_ctx: &mut Context<'_>, parent_frame: f32, delta_seconds: f32, parent_looped: bool, ) -> ss_instance_step_result

Drive the slot for one tick. Configures child_ctx on transition edges and advances its frame either by parent-relative seek or by delta-time update depending on independent.

Trait Implementations§

Source§

impl Default for InstanceSlot

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> 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, 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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more