Skip to main content

Scene

Struct Scene 

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

Records a scene imperatively, manim-style: add, play, wait. Nothing renders here.

Implementations§

Source§

impl Scene

Source

pub fn new() -> Self

An empty scene at time 0.

Source

pub fn add(&mut self, m: VState) -> MobjectId

Adds a mobject at the current time.

Source

pub fn remove(&mut self, id: MobjectId)

Removes a mobject at the current time.

Source

pub fn state(&self) -> &SceneState

The scene as of the current time, e.g. for positioning relative to other mobjects.

Source

pub fn time(&self) -> f32

Current time in seconds.

Source

pub fn play(&mut self, anim: impl Animation + 'static)

Plans anim against the current state, records it and advances time past it.

Source

pub fn wait(&mut self, secs: f32)

Holds still for secs.

Source

pub fn always( &mut self, id: MobjectId, f: impl Fn(&SceneState, f32) -> VState + Send + Sync + 'static, )

From now on, mobject id is f(scene, secs_since_now) at every frame, until removed.

f sees the scene as animated plus the output of updaters registered before it, so register in dependency order. Animations still plan against the un-updated state.

Source

pub fn marker(&mut self, name: &str)

Names the current time as a seek point.

Source

pub fn bake(self) -> BakedTimeline

Finishes recording.

Trait Implementations§

Source§

impl Default for Scene

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Scene

§

impl !UnwindSafe for Scene

§

impl Freeze for Scene

§

impl Send for Scene

§

impl Sync for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

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.