let t = 0.05;
let tz=0;
function setup() {
createCanvas(480,480);
noStroke();
colorMode(HSB,360,100,100);
}
function draw() {
background(0);
let tx=100;
for(let x=0; x<width;x+=10){
let ty=100;
for(let y=0; y<height; y+=10){
//noise 函数增加了第三个参数 tz,使得某一位置的颜色可以根据 时间的增长而进行平滑的随机变化
let c = noise(tx,ty,tz)*60;
ty +=t;
c=map(c,0,60,-100,500);
fill(c,100,100);
rect(x,y,map(c,-100,500,0,15),map(c,-100,500,0,15));
}
tx += t;
tz += 0.0005;
}
}