sin
code:code.js
var px;
function setup(){
createCanvas(600,600);
fill(255);
}
function draw(){
background(0);
px = 100 * sin(frameCount*0.01) + width / 2;
ellipse(px, height/2 , 10, 10);
}
code: code2.js
var px;
var px;
var ax = 200;
var ay = 200;
function setup(){
createCanvas(600,600);
fill(255);
}
function draw(){
background(0);
px = ax * sin(frameCount*0.01) + width / 2;
py = ay * cos(frameCount*0.01) + height/2;
ellipse(px, py, 10, 10);
}