Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num=100;
- float step, maxDist, theta;
- void setup() {
- size(1000, 1000);
- rectMode(CENTER);
- noStroke();
- fill(255);
- step = width/num;
- maxDist = dist(0, 0, width/2, height/2);
- }
- void draw() {
- background(#202020);
- for (int i=0; i<num; i++) {
- for (int j=0; j<num; j++) {
- pushMatrix();
- float x=step/2+i*step;
- float y=step/2+j*step;
- float distance = dist(x, y, width/2, height/2);
- float sz = map(distance, 0, maxDist, step*1,step*.15);
- float sc = map(sin(theta),-1,1,.5,2);
- float lerpAmount = map(distance, 0, maxDist, 0,1);
- color c = lerpColor(#E8F5AF ,#405A41 , lerpAmount);
- translate(x, y);
- fill(c);
- ellipse(0, 0, sz*sc,sz*sc);
- popMatrix();
- }
- }
- theta += 0.0523;
- //if (frameCount%2==0 && frameCount<121) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement