老师 您好 帮我看看效果吧
来源:3-4 编程练习
小虾虾小
2019-11-06 15:15:33
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>canvas画直线3-4</title>
<style>
canvas{background-color:lightpink;}
</style>
</head>
<body>
<canvas id="canvas" width="600" height="600">
您的浏览器不支持canvas
</canvas>
<script>
//在此处填写代码
var canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d');
ctx.moveTo(0,100);
ctx.lineTo(100,100);
ctx.lineTo(100,200);
ctx.lineTo(200,200);
ctx.lineTo(200,300);
ctx.lineTo(300,300);
ctx.lineTo(300,400);
ctx.lineTo(400,400);
ctx.lineTo(400,500);
ctx.lineTo(0,500);
ctx.stroke();
</script>
</body>
</html>
1回答
同学你好,
代码实现效果很棒,优秀!
继续加油~
相似问题