24 lines
486 B
Rust
24 lines
486 B
Rust
use nannou::prelude::*;
|
|
|
|
fn main() {
|
|
nannou::sketch(view).run();
|
|
}
|
|
|
|
fn view(app: &App) {
|
|
let draw = app.draw();
|
|
|
|
draw.background().color(PLUM);
|
|
|
|
|
|
let sine = (app.time()*3.0).sin();
|
|
let slowersine = (app.time()).sin();
|
|
|
|
let boundary = app.window_rect();
|
|
|
|
let x = map_range(sine, -1.0, 1.0, boundary.left(), boundary.right());
|
|
let y = map_range(slowersine, -1.0, 1.0, boundary.bottom(), boundary.top());
|
|
|
|
|
|
draw.ellipse().color(STEEL_BLUE).x_y(x, y);
|
|
}
|