Skip to main content

ShatterConfig

Struct ShatterConfig 

Source
pub struct ShatterConfig {
    pub delay: f64,
    pub duration: f64,
    pub mode: ShatterMode,
    pub pieces: u32,
    pub seed: u32,
    pub origin: ShatterOrigin,
    pub spread: f32,
    pub spin: f32,
    pub depth: f32,
    pub fade: bool,
}
Expand description

Configuration for the shatter animation effect: the node’s own rendered subtree — background, border, content and children, exactly as it would have painted — is rasterised once, cut into pieces convex cells by a deterministic Voronoi partition seeded by seed, and each cell is flown away from origin, spun and faded independently.

seed and the sampled instant fully determine every shard’s cell, direction, spin and depth — two renders of the same file at the same time are byte-identical.

mode decides which end of the timeline is the intact node and which is the fully dispersed one, and what happens once delay + duration has elapsed:

  • "out" (default): assembled at delay, fully dispersed at delay + duration. Outside [delay, delay + duration) the effect contributes nothing at all — the node renders byte-identically to one with no shatter effect in its animation list, the same hard short-circuit chromatic_aberration and zoom_blur use rather than a fade that only gets close to zero.
  • "in" is the mirror: dispersed at delay, assembled at delay + duration, and — like "out" — outside its window the node renders as if the effect were absent.
  • "hold" plays the same dispersal as "out" but freezes at the fully dispersed state once delay + duration is reached instead of short-circuiting back to the plain node — it legitimately never converges.

Fields§

§delay: f64

Delay before the shards start moving (seconds).

§duration: f64

How long the dispersal (or, in "in" mode, the assembly) takes (seconds).

§mode: ShatterMode

Which end of the timeline is intact and what happens after delay + duration. See the type-level doc comment.

§pieces: u32

Number of Voronoi shards (default 24, clamped 1..=64).

§seed: u32

Seed for the deterministic Voronoi partition and every shard’s direction/spin/depth jitter.

§origin: ShatterOrigin

Point shards fly away from (or, in "in" mode, converge toward), as a fraction of the node’s own box ({ "x": 0.5, "y": 0.5 } is the centre, the default).

§spread: f32

Radial travel multiplier at full dispersal, relative to the node’s own diagonal (default 1.0). 0 pins shards in place — only spin, depth and fade remain visible.

§spin: f32

Maximum rotation in degrees a shard reaches at full dispersal (default 90); each shard’s own sign and magnitude are jittered from seed.

§depth: f32

Per-shard scale modulation at full dispersal, the same “0.0 = none” semantics as OrbitConfig::depth (default 0.4): each shard’s own signed depth is jittered from seed, so some shards appear to come toward the camera (scale > 1) while others recede (scale < 1).

§fade: bool

Fade each shard’s opacity to zero as it reaches full dispersal (default true). With mode: "in" this is a mirror: shards start transparent and reach full opacity as they assemble.

Trait Implementations§

Source§

impl Clone for ShatterConfig

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 Debug for ShatterConfig

Source§

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

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

impl<'de> Deserialize<'de> for ShatterConfig

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 ShatterConfig

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 PartialEq for ShatterConfig

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 Serialize for ShatterConfig

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

impl StructuralPartialEq for ShatterConfig

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

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> 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.