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.
Scrollable
s automatically implement Animate
.
When a Scrollable
also implements Render
, the rendered image is the
current state of the animation.
Required Associated Types§
Required Methods§
Sourcefn state(&self) -> &ScrollingState
fn state(&self) -> &ScrollingState
A ScrollingState
indicating the current point in the animation.
Sourcefn state_mut(&mut self) -> &mut ScrollingState
fn state_mut(&mut self) -> &mut ScrollingState
A ScrollingState
indicating the current point in the animation, as
a mutable reference.
Provided Methods§
Sourcefn current_brightness_at(&self, x: usize, y: usize) -> u8
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
.