<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,maximum-scale=1.0,minimum-scale=1.0" /><title>无标题文档</title></head><body> <canvas id="box" width="300" height="300" ></canvas> <script type="text/javascript"> var boxObj = document.getElementById('box'); var boxTxtObj = boxObj.getContext('2d'); boxObj.fillStyle = '#999999'; boxObj.fillRect(0,0,300,300); boxTxtObj.fillStyle = '#666666'; boxTxtObj.fillRect(100,100,111,111); </script></body></html>
2 回答
已采纳
OlderSkee
TA贡献123条经验 获得超103个赞
boxTxtObj.fillStyle = '#999999';
boxTxtObj.fillRect(0, 0, 300, 300);
在获得的2d画布上作图 ,一切操作都是在这个上面 boxTxtObj
添加回答
举报
0/150
提交
取消