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 svg = fractalToSVG(fractal, sideLength);

    const divSpiral = document.getElementById("spiral") as HTMLDivElement;
    divSpiral.innerHTML = svg;
    // document.body.append(svg);
}

document.addEventListener("DOMContentLoaded", pageInit);