2020
10-08
10-08
JavaScript实现像雪花一样的Hexaflake分形
编写如下的函数:functiondrawHexagon(x,y,L){ctx.beginPath();ctx.moveTo(x-sqrt3/2*L,y-L/2);ctx.lineTo(x-sqrt3/2*L,y+L/2);ctx.lineTo(x,y+L);ctx.lineTo(x+sqrt3/2*L,y+L/2);ctx.lineTo(x+sqrt3/2*L,y-L/2);ctx.lineTo(x,y-L);ctx.closePath();ctx.fillStyle="#00FFFF";ctx.fill();} 函数中sqrt3的值为Math.sqrt(3...
继续阅读 >