• JavaScript graphic example: H fractal


    H fractal is a kind of fractal pattern evolved from a letter H into a labyrinth like scene. Its construction process is as follows: take a center point (x, y), and draw a horizontal line with length L and two vertical lines with length h from this center point to form a letter “H” shape; […]

  • JavaScript graphic example: hexaflake fractal like snowflake


    Write the following function:    function drawHexagon(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();    } The value of sqrt3 in the function is math. Sqrt (3). The function is: take the coordinate (x, y) as the center […]