老师请检查,这是等边吗

来源:3-5 编程练习

慕丝1342

2020-04-30 00:05:38

<!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'),
	    ctx=canvas.getContext('2d');
	
	ctx.moveTo(100,300);
	ctx.lineTo(300,100);
	ctx.strokeStyle='red';
	ctx.stroke();
	ctx.beginPath();
	
	ctx.moveTo(300,100);
	ctx.lineTo(500,300);
	ctx.strokeStyle='blue';
	ctx.stroke();
	ctx.beginPath();
	
	ctx.moveTo(100,300);
	ctx.lineTo(500,300);
	ctx.strokeStyle='green';
	ctx.stroke();
	ctx.beginPath();
	
	</script>
</body>

</html>


写回答

1回答

好帮手慕粉

2020-04-30

同学你好,代码实现的是正确的,练习要求实现等腰即可呢。

祝学习愉快~

0

0 学习 · 6815 问题

查看课程