Module scrolling_statics

Module scrolling_statics 

Source
Expand description

Support for scrolling arbitrary static images horizontally.

ScrollingStatics can be used for static slices of any type implementing Render.

§Example

use microbit::display::nonblocking::{Display, Frame, MicrobitFrame};
use microbit_text::scrolling::Animate;
use microbit_text::scrolling_text::ScrollingStaticText;
use microbit_text::image::BitImage;
const BLANK: BitImage = BitImage::blank();
const HEART: BitImage = BitImage::new(&[
    [0, 1, 0, 1, 0],
    [1, 0, 1, 0, 1],
    [1, 0, 0, 0, 1],
    [0, 1, 0, 1, 0],
    [0, 0, 1, 0, 0],
]);
let mut display = MicrobitDisplay::new(...);
let mut scroller = ScrollingStatics::default();
let frame = MicrobitFrame::default();
scroller.set_images(&[&HEART, &BLANK, &HEART]);
while !scroller.is_finished() {
    // every 50ms or so
    scroller.tick();
    frame.set(scroller);
    display.show_frame(frame);
}

Structs§

ScrollingStatics
A Scrollable displaying a static slice of arbitrary images.