xxxxxxxxxx
29
//write function and give it an argument called factor
//it's a general function that take 2 numbers an multiplies them
let m=0;
let speed=1;
function multi(x, factor) {
return factor * x;
}
function move(){
return m=speed+1;}
function bounce(){
if (m>=height){
m=0;
}
}
function setup() {
createCanvas(400, 400);
textSize(90);
console.log(multi(10, 70));
}
function draw() {
background(220);
ellipse(multi(100, 2), m, 100);
text(multi(10, 70)-m, 100, 100);
move();
bounce();
}