Module particles

Module particles 

Source
Expand description

Particle emitter builders.

Particles are small images spawned continuously from an emitter. Each particle has properties like velocity, lifetime, and color. The GPU handles rendering, so thousands of particles run smoothly.

use std::f64::consts::PI;
use core_animation::prelude::*;

let emitter = CAEmitterLayerBuilder::new()
    .position(320.0, 320.0)
    .shape(EmitterShape::Point)
    .particle(|p| p
        .birth_rate(100.0)
        .lifetime(5.0)
        .velocity(80.0)
        .emission_range(PI * 2.0)  // all directions
        .color(Color::CYAN)
        .image(ParticleImage::soft_glow(64))
    )
    .build();

For simple point bursts, use PointBurstBuilder instead.

Structs§

CAEmitterCellBuilder
Builder for a particle type.
CAEmitterLayerBuilder
Builder for a particle emitter layer.
PointBurstBuilder
Simpler builder for particles bursting outward from a point.

Enums§

EmitterMode
Mode determining where on the shape particles spawn.
EmitterShape
Shape of the emitter - where particles spawn.
ParticleImage
Pre-built particle images.
RenderMode
Render mode determining how particles are composited.