在广场的大屏幕上看到了随韵律跳动的闪烁图谱,就想知道用Processing该怎样编出来这样的效果呢?于是就出现了下面的拙劣产品。
优点:有点效果了;
缺点:不能随韵律跳动,也没有节奏,需要改进。
源代码:
void setup() {
size(600, 600);
smooth();
background(0);
colorMode(RGB,255);
noFill();
}
void draw() {
for(int d=0;d<80;d+=10)
{
for(int x=50;x<640;x+=100)
{
for(int y=50;y<640;y+=100)
{
stroke(random(255),random(255),random(255));
strokeWeight(4);
rectMode(CENTER);
//fill(random(255),random(255),random(255),50);
rect(x,y,d,d);
}
}
}
}
效果:
