xxxxxxxxxx
22
let angle = 0;
let aVelocity = 0.03;
function setup() {
createCanvas(560,390);
}
function draw() {
background(220);
let amplitude = 200;
let x = amplitude * sin(angle);
angle += aVelocity; //use the concept of angular velocity to increment an angle variable
translate(width/2, height/2);
stroke(50);
strokeWeight(2);
fill(63,63,147);
line(0, 0, x, 0);
ellipse(x, 0, 48, 48);
}