Viewing a saved revision (read-only)
62030bb04a9d48408a9507b5c2ee0ca3
Fork of Sierpinski Triangle
This interactive fractal displays a Sierpinski triangle that divides into recursively smaller subtriangles on an HTML5 Canvas. The branching depth changes dynamically based on mouse position, ranging from zero to ten subdivisions. The code uses the Canvas API’s `getContext` and `fill` methods, with `devicePixelRatio` to ensure sharp rendering on high-resolution displays. Moving the mouse horizontally triggers a `mousemove` event, recalculating depth and redrawing the triangle with `clearRect` and recursive function calls.
AI-generated descriptionInteractive tree fractal with Canvas.
Move the mouse to change the branching!
Draws from HTML5 Examples.
Extended to use high resolution Canvas for high pixel density displays.