Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float unit, theta;
- int num = 20;
- void setup() {
- size(500, 500);
- unit = width/num;
- noStroke();
- rectMode(CENTER);
- }
- void draw() {
- randomSeed(60);
- background(0);
- for (int y=0; y<=num; y++) {
- for (int x=0; x<=num; x++) {
- float distance = dist(width/2, height/2, x*unit, y*unit);
- float offSet = map(distance, 0, width/2+height/2, 0, TWO_PI);
- float sz = unit;
- float lerpAmount = map(distance, 0, width/2+height/2, 0, 1);
- float e = map(sin(theta+offSet*2), -1, 1, 0, unit/2);
- color col = lerpColor(#71A1FF, #0E103E, lerpAmount);
- if (random(1)>.2) {
- fill(col);
- } else {
- fill(#dddddd);
- }
- pushMatrix();
- translate(x*unit, y*unit);
- rect(0, 0, sz, sz,e);
- popMatrix();
- }
- }
- theta -= 0.0523;
- //if (frameCount%3==0 && frameCount<121) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement