Canvas fillRect() 方法

观看不同值的演示 fillRect() 方法.

或者点击指定值查看结果

fillRect(0,0,150,100);
fillRect(10,0,150,100);
fillRect(20,0,150,100);
fillRect(30,0,150,100);
fillRect(50,0,150,100);
fillRect(100,0,150,100);
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
let c = document.getElementById('myCanvas');
let ctx = c.getContext('2d');
ctx.fillRect(0,0,150,100);

在编辑器中更多地使用代码: 亲自尝试一下 ❯