SOURCE

let x=10;
let y=10;
let d=20;
let speed=8;
let speedq=7;
function setup(){
createCanvas(500,150);
}
function draw(){
background(280,90);
x+=speed;
y+=speedq;
if((x>500)||(x<10)){
speed=-speed;
}
if((y>150)||(y<10)){
speedq=-speedq;
}
ellipse(x,y,d,d);
}
console 命令行工具 X clear

                    
>
console