main
annieversary 2021-08-18 23:31:29 +02:00
parent 808fc8e90b
commit a18f62e9fc
3 changed files with 74 additions and 0 deletions

8
Cargo.lock generated
View File

@ -2380,6 +2380,14 @@ dependencies = [
"utils", "utils",
] ]
[[package]]
name = "subtitled6"
version = "0.1.0"
dependencies = [
"nannou",
"utils",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.74" version = "1.0.74"

View File

@ -0,0 +1,8 @@
[package]
name = "subtitled6"
version = "0.1.0"
edition = "2018"
[dependencies]
nannou = "0.17"
utils = { path = "../utils" }

View File

@ -0,0 +1,58 @@
use nannou::prelude::*;
use utils::*;
fn main() {
nannou::app(model).update(update).simple_window(view).run();
}
struct Model {}
fn model(_app: &App) -> Model {
Model {}
}
fn update(_app: &App, _model: &mut Model, _update: Update) {}
const D: f32 = 300.0;
fn view(app: &App, _model: &Model, frame: Frame) {
let t = frame.nth() as f32 / 60.0;
let draw = app.draw();
draw.background().color(SNOW);
let div = map_cos(t, 2.0, 50.0).floor() as i32;
let offset = D / div as f32;
let resolution = map_cos(t, 5.0, 50.0).floor() * 2.0;
for i in (0..=div).rev() {
let fi = i as f32;
draw.scissor(Rect::from_corners(vec2(-D, 0.0), vec2(D, D)))
.ellipse()
.resolution(resolution)
.w_h(offset * fi, offset * fi)
.x(offset * (div as f32 - fi) / 2.0)
.color(srgb(
i as f32 / div as f32,
0.0,
(div - i + 1) as f32 / div as f32,
));
}
for i in (0..=div).rev() {
let fi = i as f32;
draw.scissor(Rect::from_corners(vec2(D, 0.0), vec2(-D, -D)))
.ellipse()
.resolution(resolution)
.w_h(offset * fi, offset * fi)
.x(-offset * (div as f32 - fi) / 2.0)
.color(srgb(
(div - i + 1) as f32 / div as f32,
0.0,
i as f32 / div as f32,
));
}
draw.to_frame(app, &frame).unwrap();
utils::record::record(app, &frame);
}