<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#d1{
background: #CCCCFF;
border: 2px red solid;
position: absolute;
left:50%;
right: 50%;
transform: translate(-50%);
}
</style>
</head>
<body>
<canvas id="d1">
</canvas>
<script type="text/javascript">
var canvas=document.querySelector("#d1");
canvas.width="600";
canvas.height="600";
var cxt=canvas.getContext("2d");
cxt.beginPath();
cxt.strokeStyle="#008B8B";
var w=600;
var h=600;
let points=new Array(24);
for(let i=0;i<points.length;i++)
points[i]= new Array(2);
var num =24;
for(var i=0;i<num;i++){
var x=300*Math.cos(2*3.14*i/num);
var y=300*Math.sin(2*3.14*i/num);
points[i][0] = x+300;
points[i][1] = y+300;
document.writeln(x+" "+y);
}
for(var i=0;i<num;i++)
for(var j=0;j<num;j++){
cxt.moveTo(points[i][0],points[i][1]);
cxt.lineTo(points[j][0],points[j][1]);
}
cxt.stroke();
</script>
</body>
</html>
更多【css-HTML CSS JS 画的效果图】相关视频教程:www.yxfzedu.com