int X = 30, Y = 30; float XX, YY, MM; void setup() { size(600, 600); frameRate(30); smooth(); noStroke(); XX = width / X; YY = height / Y; MM = sqrt(width * width + height * height); } void draw() { float xc = XX / 2; background(0, 64, 64); for (int x = 0; x < X; x++, xc += XX) { float side = sqrt((XX * XX) / 2) / 2, yc = YY / 2; for (int y = 0; y < Y; y++, yc += YY) { float ax = width / 2 + width / 2 * sin(3 * radians(frameCount) + PI / 2), ay = height / 2 + height / 2 * sin(4 * radians(frameCount)); pushMatrix(); translate(xc, yc); rotate(atan2(ay - yc, ax - xc)); float d = dist(xc, yc, ax, ay); float s = sin(map(d, 0, MM / 5, PI / 2, -PI / 2)); fill(255, noise(xc, yc) * (127 + 127 * s)); quad(-side, -side, side, -side, side, side, -side, side); popMatrix(); } } }