@davidsmaynard/attractor_iterator

1.0.0 • Public • Published

Pickover's Chaotic Attractor Iterator

Here is part of my latest software art project: An implementation in JavaScript (ES6) of Clifford A. Pickover's classic chaotic attractor. Try it here. Watch as a beautiful picture, one that no one has ever seen before, fades slowly into view. This module was a result of refactoring the inner loop of the attractor into a module. The parent Vue 2.0 app can now use either a Javascript or a WASM (from Rust) module to compute the next frame's pixels.

The image is generated by computing a histogram of the points visited in the image by continuously iterating a chaotic attractor in the browser's background.

Definition:

x = sin(b*y) - c sin(b*x)
y = sin(a*x) + d cos(a*y)

where a, b, c, d are the dour floating point variables that define each attractor. For each new image the four variables are chosen at random. Next the point (x,y) is iterated to a new point (x, y). This point is then mapped into the image space to select a pixel. This pixel in the image is made one point darker on a scale of [255, 0] = [pure white, pure black]. The pixels are iterated continuously in this manner for a specified number of milliseconds, usually 15, or just less then one full animation frame. The module keeps track of how many total iterations have been completed, how many different pixels have been touched, and how many pixels have been completely blackened (RGB=0,0,0). This information is then used by the calling program to decide whether to continue iterating for another animation frame, or pause the iteration or to start iterating a new attractor. This module is only concerned with calculating the pixel values for the next frame. Actual drawing of the image onto the screen is handled by the calling application and is done using a Javascript 2d canvas.

npm publish --access public

Readme

Keywords

none

Package Sidebar

Install

npm i @davidsmaynard/attractor_iterator

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

5.98 kB

Total Files

4

Last publish

Collaborators

  • davidsmaynard