SOURCE

console 命令行工具 X clear

                    
>
console
let a=55;
let x=55;
let y=71;
let d=30;
let speedx = 6;
let speedy = 7;
let c=0
function setup() {
    createCanvas(500, 500);
    noStroke();
    colorMode(HSB,360,300,50);
    }
function draw() {
    c++;
    if(c>360){
        c=0;
    }
    x += speedx;
    y += speedy;
    if((x > width-d/2) || (x < d/2)){
        speedx = - speedx;
    }
    if((y > width-d/2) || (y < d/2)){
        speedy = - speedy;
    }
    fill(c,50,90)
ellipse(x, y, d, d);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.min.js"></script>