<!DOCTYPE html><html><head><meta charset="UTF-8"><title>canvas图形变换</title><style type="text/css">.canvas{border: 1px solid red;}</style></head><body><canvas id="myCanvas" class="canvas" width="600px" height="600px">您的浏览器不支持canvas</canvas><script type="text/javascript">//获取DOMvar canvas = document.getElementById('myCanvas');//获取绘图上下文var ctx = canvas.getContext('2d');ctx.moveTo(300,300);ctx.lineTo(400,400);ctx.strokeStyle = 'yellow';ctx.stroke();ctx.beginPath();ctx.moveTo(500,500);ctx.lineTo(600,600);ctx.strokeStyle = 'yellow';ctx.stroke();</script></body></html>
添加回答
举报
0/150
提交
取消