大家可以看看这篇文章,写得挺好的http://www.zhangxinxu.com/wordpress/2012/06/css3-transform-matrix-%E7%9F%A9%E9%98%B5/
2016-11-03
绘制任意边的多边形function drawStar(ctx,n,R,r ,x ,y,rot){ -Math.sin((deg/4+i*deg-rot)/180*Math.PI)*R+y);
ctx.lineTo(Math.cos(((deg-deg/4)+i*deg-rot)/180*Math.PI)*r+x,
-Math.sin(((deg-deg/4)+i*deg-rot)/180*Math.PI)*r+y);
}
ctx.lineTo(Math.cos(((deg-deg/4)+i*deg-rot)/180*Math.PI)*r+x,
-Math.sin(((deg-deg/4)+i*deg-rot)/180*Math.PI)*r+y);
}
2016-11-03
每个角72°
360/5=72°
每两个外圈顶点跟圆心连在一起的角度为72
再用直角90-72=18
又因为72°平分两个一模一样的角度,所以除以2=36°
36°+18°=54°
360/5=72°
每两个外圈顶点跟圆心连在一起的角度为72
再用直角90-72=18
又因为72°平分两个一模一样的角度,所以除以2=36°
36°+18°=54°
2016-11-02