xxxxxxxxxx
let x,y
let sx,sy
function setup() {
colorMode(HSB,100);
createCanvas(400, 400);
background(200,10);
x=random(0,width)
y=random(height)
// console.log(x)
// console.log(y)
//background(0);
}
function draw() {
frameRate(20)
sx=random(-10,10)
sy=random(-30,30)
noStroke();
let c = map(y, 0, height, 0,100);
console.log(c);
//color, saturation, brightness
fill(c,100,100);
circle(x,y,40)
x=x+sx
y=y+sy
//if (x>width||x<0){sx=-sx}
//if (y>width||y<0){sy=-sy}
constrain(x,0,width);
constrain(y,0,height);
//console.log(sx)
//circle in the centre
let centerC=map(y, 0, height, 0,100);
noStroke
fill(centerC,50,100)
circle(width/2,height/2,200*sin(frameCount*0.1))
}