xxxxxxxxxx
24
//we need to have a variable to track what value of angle the wave should start with
let startAngle = 0;
let angleVel = 0.23;
function setup() {
createCanvas(560,390);
}
function draw() {
background(220);
//in order to move the wave, we start at a different theta value each frame
startAngle += 0.015;
let angle = startAngle;
for (let x = 0; x <= width; x += 15) {
let y = map(sin(angle), -1, 1, 0, height);
stroke(50);
fill(63,63,147,150);
strokeWeight(2);
ellipse(x, y, 48, 48);
angle += angleVel;
}
}