3-5编程练习
来源:3-5 编程练习
qq_紾悕_1
2019-05-29 18:40:21
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>canvas</title>
<style>
canvas{background-color:lightpink;}
</style>
</head>
<body>
<canvas id="canvas" width="600" height="600">
您的浏览器不支持canvas
</canvas>
<script>
//在此处填写代码
var canvas = document.getElementById('canvas');
var c = canvas.getContext("2d");
c.moveTo(300,100);
c.lineTo(500,400);
c.strokeStyle="blue";
c.stroke();
c.beginPath();
c.moveTo(500,400);
c.lineTo(150,400);
c.strokeStyle="green";
c.stroke();
c.beginPath();
c.moveTo(150,400);
c.lineTo(300,100);
c.strokeStyle="red";
c.stroke();
</script>
</body>
</html>
1回答
好帮手慕夭夭
2019-05-29
你好同学,效果实现的很棒,继续加油,祝学习愉快!