Run rustfmt
This commit is contained in:
parent
24dc74c23b
commit
f412f975ad
1 changed files with 10 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
use nannou::{
|
use nannou::{
|
||||||
prelude::*,
|
|
||||||
color::Alpha,
|
color::Alpha,
|
||||||
noise::{Fbm, NoiseFn}
|
noise::{Fbm, NoiseFn},
|
||||||
|
prelude::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
const WIDTH: f32 = 512.0;
|
const WIDTH: f32 = 512.0;
|
||||||
|
|
@ -26,9 +26,7 @@ fn model(app: &App) -> Model {
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
Model {
|
Model { noise: Fbm::new() }
|
||||||
noise: Fbm::new(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(app: &App, model: &Model, frame: Frame) {
|
fn view(app: &App, model: &Model, frame: Frame) {
|
||||||
|
|
@ -45,15 +43,19 @@ fn view(app: &App, model: &Model, frame: Frame) {
|
||||||
|
|
||||||
let line_color = Alpha {
|
let line_color = Alpha {
|
||||||
color: LIGHTSALMON,
|
color: LIGHTSALMON,
|
||||||
alpha: 0.3
|
alpha: 0.3,
|
||||||
};
|
};
|
||||||
|
|
||||||
for x in (block_size..(frame.rect().w() as usize - block_size)).step_by(block_size / 8) {
|
for x in (block_size..(frame.rect().w() as usize - block_size)).step_by(block_size / 8) {
|
||||||
for y in (block_size..(frame.rect().h() as usize - block_size)).step_by(block_size / 8) {
|
for y in (block_size..(frame.rect().h() as usize - block_size)).step_by(block_size / 8) {
|
||||||
let half = (block_size / 2) as f32;
|
let half = (block_size / 2) as f32;
|
||||||
let v1 = vec2(x as f32, y as f32);
|
let v1 = vec2(x as f32, y as f32);
|
||||||
let noise = model.noise.get([(v1.x * x_step) as f64, (v1.y * y_step) as f64]) as f32;
|
let noise: f32 = model
|
||||||
let v2 = v1 + vec2(0.0, half * map_range(noise, -1.0, 1.0, 0.0, 2.0)).rotate(noise * TAU);
|
.noise
|
||||||
|
.get([(v1.x * x_step) as f64, (v1.y * y_step) as f64])
|
||||||
|
as f32;
|
||||||
|
let v2 =
|
||||||
|
v1 + vec2(0.0, half * map_range(noise, -1.0, 1.0, 0.0, 2.0)).rotate(noise * TAU);
|
||||||
draw.line().weight(1.0).points(v1, v2).color(line_color);
|
draw.line().weight(1.0).points(v1, v2).color(line_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue