欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

HTML5 canvas clearRect() 方法

實(shí)例

在給定矩形內(nèi)清空一個(gè)矩形:

Your browser does not support the HTML5 canvas tag.

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.fillStyle="red";
ctx.fillRect(0,0,300,150);
ctx.clearRect(20,20,100,50);

親自試一試

瀏覽器支持

Internet Explorer 9、Firefox、Opera、Chrome 以及 Safari 支持 clearRect() 方法。

注釋?zhuān)?/span>Internet Explorer 8 或更早的瀏覽器不支持 <canvas> 元素。

定義和用法

clearRect() 方法清空給定矩形內(nèi)的指定像素。

JavaScript 語(yǔ)法:

context.clearRect(x,y,width,height);

參數(shù)值

參數(shù) 描述
x 要清除的矩形左上角的 x 坐標(biāo)
y 要清除的矩形左上角的 y 坐標(biāo)
width 要清除的矩形的寬度,以像素計(jì)
height 要清除的矩形的高度,以像素計(jì)