麻烦老师检查下
来源:7-7 编程练习
Yuri沫
2020-04-24 14:40:13
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Document</title>
<style>
canvas{background-color:#000;opacity:0.7}
</style>
</head>
<body>
<canvas id="canvas" width="1200px" height="1000px">
您的浏览器不支持canvas
</canvas>
<script>
var canvas=document.getElementById("canvas");
var context=canvas.getContext("2d");
// 在此处补充代码
context.save();
context.beginPath();
context.shadowOffsetX = 5;
context.shadowOffsetY = 5;
context.shadowColor = "rgba(255,255,0,0.5)";
context.shadowBlur = 10;
context.fillStyle="yellow";
context.arc(100,100,50,0,2*Math.PI,true);
context.fill();
context.restore();
context.save();
context.lineWidth = 8;
context.strokeStyle = "rgb(89,99,151)";
context.shadowOffsetX = 5;
context.shadowOffsetY = 5;
context.shadowColor = "rgba(89,99,151,0.5)";
context.shadowBlur = 10;
context.translate(0,600);
context.beginPath();
context.moveTo(-20, 600);
context.bezierCurveTo(21, -180, 242, -124, 259, 600);
context.stroke();
context.beginPath();
context.moveTo(230, 600);
context.bezierCurveTo(187, -60, 362, -30, 515, 600);
context.stroke();
context.beginPath();
context.moveTo(450, 600);
context.bezierCurveTo(491, -480, 651, -31, 872, 600);
context.stroke();
context.beginPath();
context.moveTo(650, 600);
context.bezierCurveTo(891, -300, 1151, -11, 1240, 600);
context.stroke();
context.restore();
context.shadowOffsetX = 10;
context.shadowOffsetY = 20;
context.shadowColor = "rgba(255,255,255,0.5)";
context.shadowBlur = 15;
context.fillStyle = "white";
context.font = "bold 90px KaiTi";
context.fillText("山高月小",550,250);
</script>
</body>
</html>
1回答
同学你好,代码是正确的,继续加油。祝学习愉快~