polygon
This commit is contained in:
+19
-1
@@ -9,5 +9,23 @@ fn view(app: &App) {
|
||||
|
||||
draw.background().color(PLUM);
|
||||
|
||||
draw.ellipse().color(STEEL_BLUE);
|
||||
draw.rect().color(STEEL_BLUE);
|
||||
|
||||
let points = (0..50).map(|i| {
|
||||
let x = i as f32 - 25.0;
|
||||
let point = pt2(x, x.sin()) * 20.0;
|
||||
(point, RED)
|
||||
});
|
||||
draw.polyline().weight(3.0).points_colored(points);
|
||||
|
||||
let radius = 160.0;
|
||||
let step = 45;
|
||||
let points = (0..=360).step_by(step).map(|i| {
|
||||
let radian = deg_to_rad(i as f32);
|
||||
let x = radian.cos() * radius;
|
||||
let y = radian.sin() * radius;
|
||||
(pt2(x, y), LIGHT_STEEL_BLUE)
|
||||
});
|
||||
|
||||
draw.polygon().points_colored(points).x_y(-100.0, -200.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user