Skip to content

struct

ParticleField

pub struct ParticleField {
    pub count: u32,
    pub radius: f32,
    pub shape: ParticleShape,
    pub color: Color,
    pub color2: Color,
    pub size: f32,
    pub speed: f32,
    pub seed: u64,
    pub position: Vec3,
}

A cloud of glowing points that orbit the field's Y axis.

Fields

count

pub count: u32

How many points.

radius

pub radius: f32

The size of the area they're scattered over.

shape

pub shape: ParticleShape

The shape they're scattered in.

color

pub color: Color

One end of the colour range each point is given.

color2

pub color2: Color

The other end of the colour range.

size

pub size: f32

Point size in CSS pixels at unit distance.

speed

pub speed: f32

Orbit speed (radians per second, roughly).

seed

pub seed: u64

Seeds the random numbers, so the field is the same each time.

position

pub position: Vec3

The field's centre.

Methods

generate

pub fn generate(&self) -> (Vec<f32>, Vec<f32>)

Positions (xyz per particle) and attributes (phase, size factor, color mix — each in 0..1). Deterministic for a given seed.

Trait implementations