(&self, ctx: &C, percent: f64, highlight: bool)
| 38 | C: CanvasContext<Pattern>, |
| 39 | { |
| 40 | fn draw(&self, ctx: &C, percent: f64, highlight: bool) { |
| 41 | let r = lerp(self.old_radius, self.radius, percent); |
| 42 | let a = lerp(self.old_angle, self.angle, percent); |
| 43 | let pr = lerp(self.old_point_radius, self.point_radius, percent); |
| 44 | let p = utils::polar2cartesian(&self.center, r, a); |
| 45 | if highlight { |
| 46 | ctx.set_fill_color(self.highlight_color); |
| 47 | ctx.begin_path(); |
| 48 | ctx.arc(p.x, p.y, 2. * pr, 0., TAU, false); |
| 49 | ctx.fill(); |
| 50 | } |
| 51 | ctx.set_fill_color(self.color); |
| 52 | ctx.begin_path(); |
| 53 | ctx.arc(p.x, p.y, pr, 0., TAU, false); |
| 54 | ctx.fill(); |
| 55 | ctx.stroke(); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | impl<D> Entity for PolarPoint<D> { |
no test coverage detected