Trait Visualizer

Source
pub trait Visualizer {
    // Required methods
    fn update(&mut self);
    fn draw(&self, draw: &Draw, bounds: Rect);
}
Expand description

Core trait for all visualizers.

Visualizers follow a two-phase update/draw pattern compatible with nannou’s model-update-view architecture.

Required Methods§

Source

fn update(&mut self)

Update internal state (called each frame before drawing).

This is where visualizers should consume data from their SPSC bridges and update any internal buffers or state.

Source

fn draw(&self, draw: &Draw, bounds: Rect)

Draw the visualization within the given bounds.

The bounds rectangle defines the area where the visualizer should render. This allows multiple visualizers to be arranged in a layout.

Implementors§