Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
Show 22 fields pub duration: f64, pub background: Option<BackgroundValue>, pub children: Vec<Value>, pub prepared_children: OnceLock<Arc<dyn Any + Send + Sync>>, pub transition: Option<Transition>, pub freeze_at: Option<f64>, pub layout: Option<SceneLayout>, pub animated_background: Vec<AnimatedBackground>, pub camera: Option<Camera>, pub shake: Option<SceneShake>, pub world_position: Option<WorldPosition>, pub persist: bool, pub light: Option<SceneLight>, pub effects: Vec<PostEffect>, pub at: SceneStart, pub tail: SceneTail, pub resolved_background: ResolvedBackground, pub resolved_time_ctx: TimeCtx, pub resolved_timing: TimingMode, pub resolved_snap: Option<SnapMode>, pub vars: VarSet, pub resolved_scenario_vars: VarSet,
}

Fields§

§duration: f64§background: Option<BackgroundValue>

Unified background: color string, animated entry (with optional $ref), or array.

§children: Vec<Value>§prepared_children: OnceLock<Arc<dyn Any + Send + Sync>>

Filled once, by whoever first deserializes children into the component type it owns. rustmotion-core cannot name that type, so it is held erased; Scene::prepared_children is the typed accessor.

§transition: Option<Transition>§freeze_at: Option<f64>§layout: Option<SceneLayout>

Flex layout for automatic layer positioning

§animated_background: Vec<AnimatedBackground>

Legacy animated background (kept for backward compat)

§camera: Option<Camera>

Virtual camera with animatable x, y, zoom, rotation.

§shake: Option<SceneShake>

Declarative camera shake (issue #330): a list of beat-synced impacts, each a damped harmonic oscillator, summed and additive over camera above — a pan and a shake ride the same frame instead of fighting over one keyframe track. See SceneShake for the formula and crate::engine::shake::shake_offset for the function that evaluates it.

§world_position: Option<WorldPosition>

Position of this scene in the 2D world (used by world views).

§persist: bool

(world) Keep this scene visible after its time window ends.

§light: Option<SceneLight>

Direction the light comes from, shared by every style.material in the scene. Absent means upper-left, the convention an eye reads as “lit from above” without being told.

Declaring it once is what makes several materials look like they belong to the same frame: a per-node preset cannot agree with its neighbours about where the light is.

§effects: Vec<PostEffect>

Post-processing effects applied to the full frame buffer after Skia renders. Effects are additive and applied in declaration order.

§at: SceneStart

Where this scene starts, on the scenario’s absolute timeline (issue #336). at is absolute by definition — see the anchoring rule documented once on TimePoint. Defaults to SceneStart::Auto: immediately after the previous scene’s own window ends. Only consulted by rustmotion’s frame-task scheduler under Scenario.timing = "v2"; a "v1" scenario places scenes back-to-back regardless of what this field says.

§tail: SceneTail

How this scene behaves when the next scene’s transition overlaps into it, rendering it past its own duration (issue #336, timing: "v2" only). Defaults to SceneTail::Freeze.

§resolved_background: ResolvedBackground

Post-resolution background (populated by include.rs, ignored by serde).

§resolved_time_ctx: TimeCtx

The beat-grid context (bpm/beat_offset) of the Scenario this scene was declared in — populated by Scenario’s own Deserialize impl, before include.rs resolution ever runs, not by include.rs itself (issue #336; see the doc on ResolvedScenario for why). scene_start is always 0.0 here: Scene::at is resolved with TimePoint::resolve_absolute, which ignores it.

§resolved_timing: TimingMode

The Scenario.timing this scene was declared under. Same populate-at-deserialize-time note as Scene::resolved_time_ctx.

§resolved_snap: Option<SnapMode>

The Scenario.snap this scene was declared under. Same populate-at-deserialize-time note as Scene::resolved_time_ctx.

§vars: VarSet

This scene’s own declared variables (issue #329): shadow a same-named scenario-level variable (Scenario::vars) for expressions evaluated inside this scene, and are themselves invisible from any other scene — see rustmotion_core::vars::VarScope for the shadowing rule and why that isolation needs no special-case error handling. A variable with no animation here is a constant, same as at the scenario level.

§resolved_scenario_vars: VarSet

The enclosing Scenario::vars this scene was declared under — populated by Scenario’s own Deserialize impl, before include.rs resolution ever runs, not by include.rs itself. Same populate-at-deserialize-time note as Scene::resolved_time_ctx: ResolvedScenario carries no scenario-level fields of its own, so anything a scene needs to remember about its enclosing Scenario has to already be sitting on the Scene by the time include.rs — a file no single workstream owns — merges included scenes in.

Trait Implementations§

Source§

impl Debug for Scene

Source§

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

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

impl<'de> Deserialize<'de> for Scene

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Scene

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Scene

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !Freeze for Scene

§

impl !RefUnwindSafe for Scene

§

impl !UnwindSafe 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.