Crate plasma

source ·
Expand description

A Plasma struct and tools for rendering animated eye-candy pixels.

§Example

extern crate rand;
extern crate plasma;

use plasma::*;

fn main() {
    let min_steps = 80.0f32;
    let max_steps = 200.0f32;
    let plasma_width = 200u32;
    let plasma_height = 200u32;
    let mut rng = rand::thread_rng();
    let cfg = PhaseAmpCfg::new(min_steps, max_steps);

    let mut plasma = Plasma::new(plasma_width, plasma_height, cfg, &mut rng);

    let pitch = plasma_width as usize * PixelBufRGB24::PIXEL_BYTES;
    let mut buffer_rgb24 = vec![0u8; pitch * plasma_height as usize];
    plasma.render::<PixelBufRGB24, PlasmaICP, PlasmaMixer>(&mut buffer_rgb24, pitch, None);
    plasma.update(&mut rng);
}

Structs§

Traits§

Functions§

  • Renders the part of the plasma into the provided buffer without the Plasma instance.

Type Aliases§