xxxxxxxxxx
34
// Play with these parameters
a = -1.4;
b = 1.6;
c = 1.0;
d = 0.7;
// Number of loops to draw each frame
let loops = 100;
let x = 0;
let y = 0;
let xNext, yNext;
function setup() {
createCanvas(400, 400);
stroke(0, 20);
background(220);
}
function draw() {
for (i = 0; i < loops; i++) {
xNext = sin(a * y) + c * cos(a * x);
yNext = sin(b * x) + d * cos(b * y);
let xScreen = map(xNext, -3, 3, 0, width);
let yScreen = map(yNext, -3, 3, 0, height);
point(xScreen, yScreen);
x = xNext;
y = yNext;
}
}