Skip to content

Commit ae86f72

Browse files
committed
style
1 parent 9644a0d commit ae86f72

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

examples/boids/src/simulation.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,26 +108,20 @@ impl Component for Simulation {
108108
for boid in &self.boids {
109109

110110
let color = format!("hsl({:.3}rad, 100%, 50%)", boid.hue);
111-
112111
let mut points = String::new();
113-
114-
const SHAPE: [(f64, f64); 3] = [
112+
for offset in [
115113
(0. * math::FRAC_TAU_3, 2.0),
116114
(1. * math::FRAC_TAU_3, 1.0),
117115
(2. * math::FRAC_TAU_3, 1.0),
118-
];
119-
120-
for offset in SHAPE
116+
]
121117
.iter()
122118
.copied()
123119
.map(move |(angle, radius_mul)| Vector2D::from_polar(angle + boid.velocity.angle(), radius_mul * boid.radius)) {
124120
let Vector2D { x, y } = boid.position + offset;
125-
126121
// Write to string will never fail.
127122
let _ = write!(points, "{x:.2},{y:.2} ");
128123
};
129124

130-
131125
<polygon {points} fill={color} />
132126
}
133127
</svg>

0 commit comments

Comments
 (0)