Sketch: Spinny :D
parent
587b8a2671
commit
06644217dd
|
@ -0,0 +1,5 @@
|
|||
/target
|
||||
|
||||
# ffmpeg -framerate 60 -i recordings/%05d.png -pix_fmt yuv420p recording.mp4
|
||||
/recordings
|
||||
/recording.mp4
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "sketch_spinny"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
sketchlib = { path = "../sketchlib" }
|
|
@ -0,0 +1,51 @@
|
|||
use sketchlib::nannou;
|
||||
use sketchlib::palettes::TRANS_FLAG;
|
||||
use sketchlib::prelude::*;
|
||||
|
||||
fn main() {
|
||||
nannou::app(model)
|
||||
.size(1260, 1260)
|
||||
.update(update)
|
||||
.simple_window(view)
|
||||
.run();
|
||||
}
|
||||
|
||||
struct Model {}
|
||||
|
||||
fn model(_app: &App) -> Model {
|
||||
Model {}
|
||||
}
|
||||
|
||||
fn update(app: &App, model: &mut Model, _update: Update) {
|
||||
// im pickle rick
|
||||
}
|
||||
|
||||
const TAU: f64 = 6.283185307179586;
|
||||
|
||||
fn view(app: &App, _model: &Model, frame: Frame) {
|
||||
let window_rect = app.window_rect();
|
||||
|
||||
let t = app.duration.since_start.as_secs_f64();
|
||||
|
||||
let draw = app.draw().scale(1.0);
|
||||
draw.background().color(BLACK);
|
||||
|
||||
let bottom = window_rect.bottom(); // 🥺
|
||||
let height = window_rect.h();
|
||||
|
||||
for i in 0..25 {
|
||||
let y = bottom / 2.0 + i as f32 * height / 50.0;
|
||||
|
||||
let mut rotation: f32 = (t * TAU / 2.0) as f32 * ((i + 1) as f32) / 25.0;
|
||||
|
||||
draw.quad()
|
||||
.rotate(rotation)
|
||||
.color(TRANS_FLAG[i % TRANS_FLAG.len()])
|
||||
.width(height / 25.0)
|
||||
.height(height / 25.0)
|
||||
.x_y(0.0, y);
|
||||
}
|
||||
|
||||
draw.to_frame(app, &frame).unwrap();
|
||||
dump_frame(app, &frame).unwrap();
|
||||
}
|
Loading…
Reference in New Issue