xxxxxxxxxx
29
let offset = 0;
function setup() {
createCanvas(600, 600);
background(0);
}
function yVal(x, period, phase, amplitude) {
return sin((TWO_PI * x) / period + phase) * amplitude;
}
function draw() {
background("rgba(13, 39, 54, 0.025)");
translate(width / 2 - offset, height / 2);
offset += 0.8;
for (let i = -width / 2 + offset; i <= width / 2 + offset; i += 10) {
let x = map(i, -width / 2, width / 2, -PI, PI);
stroke(0, 255, 255, 0.1);
strokeWeight(10);
ellipse(i, -yVal(x, TWO_PI, 0, height / 6), 4);
strokeWeight(1);
ellipse(i, yVal(x, PI / 2, 0, height / 3), 3);
}
}