<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <canvas id="canvas" style="border:1px solid #aaa; display: block; margin: 50px auto; "></canvas> <script> window.onload=function(){ var canvas=document.getElementById("canvas"); canvas.width=800; canvas.height=800; var context=canvas.getContext("2d"); context.beginPath(); context.moveTo(100,100); context.lineTo(700,700); context.lineTo(100,700); context.closePath(); context.lineWidth=10; context.fillStyle="red"; context.strokeStyle="#058"; context.stroke(); ontext.fill(); } </script> </body></html>
添加回答
举报
0/150
提交
取消