SOURCE

let x=40;
let y=20;
let d=40;
let a=10;
let b=9;
function setup(){
    createCanvas(200,300);
    noStroke();
}
function draw(){
    background(125);
    x+=a;
    y+=b;
   
    if(x>180||(x<20)){
        a=-a;
    }
    if(y>280||(y<20)){
        b=-b;
    }
    ellipse(x,y,d,d);
   
}
console 命令行工具 X clear

                    
>
console