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.
 
 
 

27 lines
1.1 KiB

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