老师,请检查
来源:3-5 编程练习
慕函数4436287
2019-06-05 10:44:24
<!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 ctx=canvas.getContext("2d");
ctx.moveTo(300,150);
ctx.lineTo(100,420);
ctx.strokeStyle = "red";
ctx.lineWidth = 1;
ctx.stroke();
ctx.beginPath();
ctx.moveTo(300,150);
ctx.lineTo(500,420);
ctx.strokeStyle = "blue";
ctx.lineWidth = 1;
ctx.stroke();
ctx.beginPath();
ctx.moveTo(100,420);
ctx.lineTo(500,420);
ctx.strokeStyle = "green";
ctx.lineWidth = 1;
ctx.stroke();
</script>
</body>
</html>1回答
好帮手慕夭夭
2019-06-05
你好同学,效果实现了,很棒哦!继续加油,祝学习愉快!