You can create an <canvas> object using the document.create_element method.
let canvas = document.create_element("canvas")
.unwrap()
.dyn_into::<web_sys::HtmlCanvasElement>()
.unwrap();
You can access an <canvas> object using the document.get_element_by_id method.
let button = document.get_element_by_id("my-canvas")
.unwrap()
.dyn_into::<web_sys::HtmlCanvasElement>()
.unwrap();
fillStyle - The color, gradient, or pattern used to fill the drawing.
fill_style set_fill_stylewidth - The width of the canvas.
width set_widthheight - The height of the canvas.
height set_height
features = [
'HtmlCanvasElement',
]