SOURCE

console 命令行工具 X clear

                    
>
console
let speed = 6; 
let d= 50; 
let x; 
let y;
let c=0;
function setup() { 
  createCanvas(500,500); 
  x = width/2; 
  y = height/2; 
  background(0); 
  colorMode(HSB,360,100,100,1); 

} 
function draw() {  
  c+=0.1;  
  if(c>360){  
    c=0;
  }
  fill(c,100,100,0.5);
  stroke(255);
  x += random(-speed, speed);
  y += random(-speed, speed);  
  x = constrain(x, 0, width); 
  y = constrain(y, 0, height);   
  rect(x, y, d, d); 
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.min.js"></script>