📅  最后修改于: 2022-03-11 15:01:21.632000             🧑  作者: Mango
//set a const for all the code
const context = canvas.getContext('2d');
//to clear the canvas use:
context.clearRect(0, 0, canvas.width, canvas.height);
//if the canvas is with 300 and height 450:
context.clearRect(0, 0, 300, 450);