xxxxxxxxxx
27
//based on coding train youtube
var x= 0;
var speed= 2;
var y = 200;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
stroke (200,20,200);
strokeWeight(4);
fill(200,100,50);
ellipse(x, y, 30,30);
if (x>width ||x<0){
fill(0);
speed= speed*-1;
}
x= x+speed
}
// how can i have it so when it hits the edges it also changes color?