You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
429 B
Rust

use std::f64;
use crate::shapes::Point;
pub fn draw_circle(center: Point, radius: f64, context: &web_sys::CanvasRenderingContext2d) {
context.move_to(center.x+radius, center.y);
context
.arc(center.x, center.y, radius, 0.0, f64::consts::PI * 2.0)
.unwrap();
}
pub fn draw_line(p1: Point, p2: Point, context: &web_sys::CanvasRenderingContext2d) {
context.move_to(p1.x, p1.y);
context
.line_to(p2.x, p2.y);
}