Skip to content

Nyan Cat Demo #1

Description

@andelf
running_cat.mp4
let image = tinygif::Gif::<Rgb565>::from_slice(include_bytes!("../../cat.gif")).unwrap();
loop {
    for frame in image.frames() {
        let start = Instant::now();
        frame.draw(&mut display.translated(Point::new(10, 80))).unwrap();
        let elapsed = start.elapsed().as_millis();
        info!("draw {}ms", elapsed);

        let delay_ms = (frame.delay_centis * 10) as u64;
        info!("delay {}", delay_ms);
        if delay_ms > elapsed {
            Timer::after(Duration::from_millis((delay_ms - elapsed) as u64)).await;
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions