xxxxxxxxxx
34
let x = 0;
let y = 0;
let xjump = 7.3;
let yjump = 5;
function setup() {
createCanvas(400, 400);
background(255);
fill(30,20);
noStroke();
}
function draw() {
colorMode(HSB);
fill(
map(x,0,width,0,360),
map(y,0,height,0,100),
map(mouseX,0,width,0,100),
map(mouseY,0,height,0,1)
);
rect(x,y,50,50);
x = x + xjump;
if(x >= width || x <= 0) {
xjump = xjump * -1;
}
y = y + yjump;
if(y >= height || y <= 0) {
yjump = yjump * -1;
}
}