82canvas and five-pointed star emblem

Description: China KMT party emblem is on the left, the right is the Chinese co-production ~ ~ Party (Tip said to be the offending content) of five-pointed star, are using HTML5 written inside the canvas. 


HTML `` `: RUN
<! DOCTYPE HTML>
<HTML>
<head>
<Meta charset =" UTF-. 8 ">
<title> and five-pointed star emblem </ title>
</ head>
<body>
<Canvas ID =" canvas "width =" 450 "height =" 450 ">
your browser does not support the canvas tag, can not see the emblem
</ canvas>
<canvas the above mentioned id =" canvas1 "width =" 450 "height =" 450 ">
your browser does not support the canvas tag, can not see the five-pointed star
</ canvas>
<Script>
var canvas = document.getElementById ( "canvas");
var context = canvas.getContext ( "2d");
context.beginPath ();
context .


context.lineWidth = "10";
context.stroke();
context.fill();
context.closePath();
context.beginPath();
for (var i = 0; i < 12; i++) {
context.lineTo(Math.cos((i * 30) / 180 * Math.PI) * 200 + 215,
Math.sin((i * 30) / 180 * Math.PI) * 200 + 215);
context.lineTo(Math.cos((i * 30 + 15) / 180 * Math.PI) * 105 + 215,
Math.sin((i * 30 + 15) / 180 * Math.PI) * 105 + 215);
}
context.fillStyle = "#ffffff";
context.fill();
context.closePath();
context.beginPath();
context.arc(215, 215, 105, 0, 360);
context.strokeStyle = "#030d48";
context.lineWidth = "10";
context.stroke();
context.closePath();
/*以上党徽,以下五角星*/
var canvas1 = document.getElementById("canvas1");
var context1 = canvas1.getContext("2d");
context1.beginPath();
context1.rotate(18*Math.PI/180);
for (i = 0; i < 5; i++) {
context1.lineTo(Math.cos((i * 72+36) / 180 * Math.PI) * 200 + 250,
Math.sin((i * 72+36) / 180 * Math.PI) * 200 + 150);
context1.lineTo(Math.cos((i * 72+72) / 180 * Math.PI) * 75 + 250,
Math.sin((i * 72+72) / 180 * Math.PI) * 75 + 150);
}
context1.fillStyle = "#ff0000";
context1.fill();
context1.closePath();
</script>
</body>
</html>
```

Guess you like

Origin www.cnblogs.com/gushixianqiancheng/p/10967106.html