Scrollable

Trait Scrollable 

Source
pub trait Scrollable {
    type Subimage: Render;

    // Required methods
    fn length(&self) -> usize;
    fn state(&self) -> &ScrollingState;
    fn state_mut(&mut self) -> &mut ScrollingState;
    fn subimage(&self, index: usize) -> &Self::Subimage;

    // Provided method
    fn current_brightness_at(&self, x: usize, y: usize) -> u8 { ... }
}
Expand description

A horizontally scrolling sequence of 5×5 images.

Scrollables automatically implement Animate.

When a Scrollable also implements Render, the rendered image is the current state of the animation.

Required Associated Types§

Source

type Subimage: Render

The type of the underlying 5×5 images.

Required Methods§

Source

fn length(&self) -> usize

The number of underlying images.

Source

fn state(&self) -> &ScrollingState

A ScrollingState indicating the current point in the animation.

Source

fn state_mut(&mut self) -> &mut ScrollingState

A ScrollingState indicating the current point in the animation, as a mutable reference.

Source

fn subimage(&self, index: usize) -> &Self::Subimage

A reference to the underlying image at the specified index.

Provided Methods§

Source

fn current_brightness_at(&self, x: usize, y: usize) -> u8

Returns the brightness value for a single LED in the current state.

Use this to implement Render.

Implementors§