52 lines
1.1 KiB
Rust
52 lines
1.1 KiB
Rust
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();
|
|
}
|