逆水行
2018-01-17 11:42
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<canvas id="canvas" style="border:1px solid #aaa; display: block; margin: 50px auto;"></canvas>
<script>
window.onload=function(){
var canvas=document.getElementById("canvas");
canvas.width=800;
canvas.height=800;
var context=canvas.getContext("2d");
context.beginPath();
for(var i=0;i<5;i++){
context.lineTo((Math.cos((18+i*72)/180*Math.PI)*300+400),
(-Math.sin((18+i*72)/180*Math.PI)*300+400));
context.lineTO((Math.cos((54+i*72)/180*Math.PI)*150+400),
(-Math.sin((54+i*72)/180*Math.PI)*150+400));
}
context.closePath();
context.lineWidth=10;
context.stroke();
</script>
</body>
</html>
已解决 o大写了
Canvas绘图详解
72881 学习 · 422 问题
相似问题