f895500a3f65d857ed17e35f50508209ac60c401 — Manuel GroƟ 8 months ago 8c7ca4f master
unu: Capture frames to png files
1 files changed, 16 insertions(+), 0 deletions(-)

M fiddling/unu/src/main.rs
M fiddling/unu/src/main.rs => fiddling/unu/src/main.rs +16 -0
@@ 22,4 22,20 @@ fn view(app: &App, frame: Frame){

    // put everything on the frame
    draw.to_frame(app, &frame).unwrap();

    // capture the output EVERY TIME
    let file_path = captured_frame_path(app, &frame);

fn captured_frame_path(app: &App, frame: &Frame) -> std::path::PathBuf {
    // Create a path that we want to save this frame to.
        .expect("failed to locate `project_path`")
        // Capture all frames to a directory called `/<path_to_nannou>/nannou/simple_capture`.
        // Name each file after the number of the frame.
        .join(format!("{:03}", frame.nth()))
        // The extension will be PNG. We also support tiff, bmp, gif, jpeg, webp and some others.