xxxxxxxxxx
48
//ref:
// Coding Challenge #116: Lissajous Curve Table: https://www.youtube.com/watch?v=--6eyLO78CY&ab_channel=TheCodingTrain
var seed = Math.random() * 1000;
var a = 2,
b = 3;
var th = 0,
seg = 0.01;
var r;
var mySize;
let colors1 = "ACEBD4-ACDEEB-21D8EA-3CC1FF-6DE4AA"
.split("-")
.map((a) => "#" + a);
let colorbg = "AEF6D2".split("-").map((a) => "#" + a);
function setup() {
mySize = min(windowWidth, windowHeight);
createCanvas(windowWidth, windowHeight);
colorMode(HSB, 360, 100, 100, 100);
r = mySize / 2;
background(colorbg);
}
function draw() {
randomSeed(seed);
noFill();
strokeCap(SQUARE);
background(colorbg);
push();
translate(width / 2, height / 2);
for (let i = 0; i < 10; i++) {
a = random(1.5, 2.5);
b = random(2, 3);
strokeWeight(random(2, 5));
stroke(random(colors1));
ellipse(
random(-i * 10, i * 10) + r * cos(a * th),
random(-i * 10, i * 10) + r * sin(b * th),
r * cos(a * (th + seg)) * 0.5,
r * sin(b * (th + seg)) * 0.5
);
}
pop();
th += seg;
}