Chaos game implementation in Javascript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.1 KiB

<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="chaos.js"></script>
<body onload="var app = new App(); app.setup()">
<canvas id="canvas" width="800" height="600"></canvas>
<input type="button" id="polygonButton" value="set polygon">
<input type="button" id="resetButton" value="reset"> <br>
<input type="text" id="nextText" placeholder="how many steps?">
<input type="button" id="nextButton" value="step"> <br>
<input type="text" id="ratioText" placeholder="ratio">
<strong>HOWTO:</strong> Click around the canvas to define corners of
a polygon. Click the "set polygon" button. Click the canvas once more
to place a starting point. Each additional click of the canvas (or
click of the "step" button) will advance the Chaos Game by the number
of steps in the field, based on the ratio in the second field. Try 0.5
with a triangle, or 0.25 with a rectangle!