Last active
December 19, 2015 17:48
-
-
Save felipap/5993616 to your computer and use it in GitHub Desktop.
Hénon attractor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
canvas { border: 1px solid #DDD; } | |
</style> | |
</head> | |
<canvas width=1500 height=1000></canvas> | |
<script> | |
var ctx = document.querySelector('canvas').getContext('2d'), | |
k = {x: 400, y:800}, | |
center = {x: 600, y:500}, | |
x = y = 0, | |
a = 1.4, b = 0.3; | |
setInterval(function draw() { | |
ctx.fillRect(center.x+x*k.x, center.y-y*k.y, 1, 1); | |
var _x = x; | |
x = y+1-(a*_x*_x); | |
y = b*_x; | |
}, 1); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment