Newer
Older
fractals / src / index.ts
import { createSquare, inwardSpiralFractal, fractalToSvg } from "./FractalSVG";

function pageInit(): void
{
    const sideLength = 400;
    const iterations = 50;
    const shrinkRate = 0.1;

    const startShape = createSquare(sideLength);
    const fractal = inwardSpiralFractal(startShape, iterations, shrinkRate);
    const divSpiral = document.getElementById("spiral") as HTMLDivElement;

    divSpiral.appendChild(fractalToSvg(fractal, sideLength));
}

document.addEventListener("DOMContentLoaded", pageInit);