move draw_exterior into utils
parent
906e2a66c5
commit
e315d00bb3
|
@ -63,8 +63,8 @@ fn view(app: &App, _model: &Model, frame: Frame) {
|
|||
}
|
||||
}
|
||||
|
||||
// draw exteriors
|
||||
draw_exterior(&draw);
|
||||
// draw exterior
|
||||
drawing::draw_exterior(&draw, 200.0, SNOW);
|
||||
|
||||
// outer draw
|
||||
for i in 0..50 {
|
||||
|
@ -80,38 +80,3 @@ fn view(app: &App, _model: &Model, frame: Frame) {
|
|||
draw.to_frame(app, &frame).unwrap();
|
||||
utils::record::record(app, &frame);
|
||||
}
|
||||
|
||||
fn draw_exterior(draw: &Draw) {
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(200.0, -1000.0),
|
||||
vec2(200.0, 1000.0),
|
||||
vec2(1000.0, 1000.0),
|
||||
vec2(1000.0, -1000.0),
|
||||
)
|
||||
.color(SNOW);
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(-200.0, -1000.0),
|
||||
vec2(-200.0, 1000.0),
|
||||
vec2(-1000.0, 1000.0),
|
||||
vec2(-1000.0, -1000.0),
|
||||
)
|
||||
.color(SNOW);
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(-1000.0, 200.0),
|
||||
vec2(-1000.0, 1000.0),
|
||||
vec2(1000.0, 1000.0),
|
||||
vec2(1000.0, 200.0),
|
||||
)
|
||||
.color(SNOW);
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(-1000.0, -200.0),
|
||||
vec2(-1000.0, -1000.0),
|
||||
vec2(1000.0, -1000.0),
|
||||
vec2(1000.0, -200.0),
|
||||
)
|
||||
.color(SNOW);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
use nannou::{color::IntoLinSrgba, draw::properties::ColorScalar, prelude::*};
|
||||
|
||||
/// Draws the opposite of a box
|
||||
pub fn draw_exterior(draw: &Draw, size: f32, color: impl IntoLinSrgba<ColorScalar> + Clone) {
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(size, -1000.0),
|
||||
vec2(size, 1000.0),
|
||||
vec2(1000.0, 1000.0),
|
||||
vec2(1000.0, -1000.0),
|
||||
)
|
||||
.color(color.clone());
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(-size, -1000.0),
|
||||
vec2(-size, 1000.0),
|
||||
vec2(-1000.0, 1000.0),
|
||||
vec2(-1000.0, -1000.0),
|
||||
)
|
||||
.color(color.clone());
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(-1000.0, size),
|
||||
vec2(-1000.0, 1000.0),
|
||||
vec2(1000.0, 1000.0),
|
||||
vec2(1000.0, size),
|
||||
)
|
||||
.color(color.clone());
|
||||
draw.quad()
|
||||
.points(
|
||||
vec2(-1000.0, -size),
|
||||
vec2(-1000.0, -1000.0),
|
||||
vec2(1000.0, -1000.0),
|
||||
vec2(1000.0, -size),
|
||||
)
|
||||
.color(color);
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
pub mod color;
|
||||
pub mod drawing;
|
||||
pub mod record;
|
||||
pub mod sequences;
|
||||
|
||||
|
|
Loading…
Reference in New Issue