Skip to main content

ParticleStyle

Enum ParticleStyle 

Source
pub enum ParticleStyle {
    Dots {
        radius: f64,
    },
    GlowDots {
        radius: f64,
    },
    Sprites {
        image: Handle<ImageAsset>,
        size: f64,
        align_to_velocity: bool,
    },
    Trails {
        length: Duration,
        width: f64,
    },
    Plexus {
        radius: f64,
        max_distance: f64,
    },
    Shape {
        radius: f64,
        shape: ParticleShape,
    },
    Bokeh {
        radius: f64,
        aperture: f32,
        focus: f32,
        shape: BokehShape,
        ring: f32,
        hardness: f32,
        highlight: f32,
    },
    Configured {
        style: Box<ParticleStyle>,
        options: StyleOptions,
    },
    Custom(Arc<dyn Fn(&[Particle], &SceneContext<'_>) -> Result<Node, ValidationError> + Send + Sync>),
}
Expand description

particle presentation. Built-ins share an instance protocol; custom callbacks run on CPU and return ordinary content or a validation error, never custom WGSL.

Variants§

§

Dots

Smooth analytic circles; radius multiplies particle.size.

Fields

§radius: f64

Base local radius.

§

GlowDots

Compact Gaussian halos with linear Plus compositing.

Fields

§radius: f64

Gaussian scale (support extends to three radii).

§

Sprites

Bilinear sprite instances, tinted by premultiplied particle color.

Fields

§image: Handle<ImageAsset>

Lazy immutable texture.

§size: f64

Full local sprite side.

§align_to_velocity: bool

Adds velocity direction to particle.rotation.

§

Trails

Eight actual historical segments per particle, not a velocity extrapolation.

Fields

§length: Duration

Historical interval.

§width: f64

Local line width.

§

Plexus

Analytic dots and bounded pairwise neighbor connections.

Fields

§radius: f64

Dot radius.

§max_distance: f64

Maximum local neighbor separation.

§

Shape

Texture-free analytic geometry.

Fields

§radius: f64

Base radius or half height.

§shape: ParticleShape

Coverage geometry.

§

Bokeh

Depth-aware, energy-compensated aperture. Depth is particle.custom[1].

Fields

§radius: f64

Base in-focus radius.

§aperture: f32

Circle-of-confusion scale.

§focus: f32

In-focus depth.

§shape: BokehShape

Aperture silhouette.

§ring: f32

Rim intensity in 0..=1.

§hardness: f32

Edge hardness in 0..=1.

§highlight: f32

Finite nonnegative HDR multiplier.

§

Configured

A built-in or custom style with explicit batch options; see StyleOptions.

Fields

§style: Box<ParticleStyle>

Underlying built-in or custom style.

§options: StyleOptions

Batch-level presentation policy.

§

Custom(Arc<dyn Fn(&[Particle], &SceneContext<'_>) -> Result<Node, ValidationError> + Send + Sync>)

CPU-only presentation callback.

Implementations§

Source§

impl ParticleStyle

Source

pub fn blend(self, blend: ParticleBlend) -> Self

Selects compositing for the entire batch, not individual GPU invocations.

Source

pub fn sheet(self, sheet: SpriteSheet) -> Self

Adds animation or atlas UVs to Sprites.

Source

pub fn trails(self, trails: TrailOptions) -> Self

Configures segment count, endpoint width/color and optional smoothing/ribbon.

Source

pub fn stretch_by_speed(self, scale: f32, maximum: f32) -> Self

Aligns and stretches geometry along the velocity, with a finite ceiling.

Source

pub fn parallax(self, offset: [f32; 2]) -> Self

Adds deterministic depth parallax and stable depth ordering.

Source

pub fn flip(self) -> Self

Enables the analytic single-axis confetti flip.

Trait Implementations§

Source§

impl Clone for ParticleStyle

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 Default for ParticleStyle

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.