How to clear the canvas for redrawing

后端 未结 23 2898
粉色の甜心
粉色の甜心 2020-11-21 11:37

After experimenting with composite operations and drawing images on the canvas I\'m now trying to remove images and compositing. How do I do this?

I need to clear th

23条回答
  •  悲哀的现实
    2020-11-21 12:25

    function clear(context, color)
    {
        var tmp = context.fillStyle;
        context.fillStyle = color;
        context.fillRect(0, 0, context.canvas.width, context.canvas.height);
        context.fillStyle = tmp;
    }
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题