Slightly altered (blured) version of Clifford attractors.
It follows the standard equations:
but after a given number of iterations one of the parameters (in this case
For more information on standard Clifford attarctors, check this post.
Slightly altered (blured) version of Clifford attractors.
It follows the standard equations:
but after a given number of iterations one of the parameters (in this case
For more information on standard Clifford attarctors, check this post.
const SIZE = 1000; // width/height of the canvas | |
const SCALE = SIZE / 4.4; // scaling factor to draw points | |
const ITER = 10000; // iterations / frame | |
const INC = 0.001; // increment of a every frame | |
// Clifford attractor parameters | |
let a = 1.48; | |
let b = 1.6; | |
let c = 1; | |
let d = 0.78; | |
// Start (x, y) position | |
let x = 0; | |
let y = 0; | |
function setup(){ | |
createCanvas(SIZE, SIZE); | |
background(200); | |
stroke(0, 0, 0, 20); | |
} | |
function draw(){ | |
translate(SIZE/2, SIZE/2); | |
// draw and update (x, y) an ITER number of times | |
// just used to make results visible faster | |
for (let i = 0; i < ITER; i++) { | |
// draw | |
point(SCALE*x, SCALE*y); | |
// update | |
let x1 = sin(a*y) + c*cos(a*x); | |
let y1 = sin(b*x) + d*cos(b*y); | |
x = x1; | |
y = y1; | |
} | |
// update a's value | |
a += 0.001 | |
} |