Advertisement
xeromino

alphaGo

Mar 19th, 2016
488
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int edge = 75, cols = 7;
  2. int step, frms = 120;
  3. float theta;
  4.  
  5. void setup() {
  6.   size(750, 540);
  7.   noStroke();
  8.   step = int((height-2*edge)/cols);
  9. }
  10.  
  11. void draw() {
  12.   background(0);
  13.   randomSeed(100);
  14.   for (int x=edge+step/2; x<width-edge; x += step) {
  15.     for (int y=edge+step/2; y<height-edge; y += step) {
  16.       float distance = dist(x, y, width/2, height/2);
  17.       float offSet = map(distance, 0, sqrt(sq(width/2-edge)+sq(height/2-edge)), 0, PI);
  18.       float sz = map(sin(-theta+offSet), -1, 1, step*.85, step*1.2);    
  19.       float sz2 = step *.8;
  20.       float a = map(sin(-theta+offSet), -1, 1, 50, 150);
  21.       for (int i=0; i<5; i++) {
  22.         fill(255, a+i*5);
  23.         ellipse(x, y, sz-i*3, sz-i*3);
  24.       }
  25.       fill(0);
  26.       if (random(1)>.2) ellipse(x, y, sz2, sz2);
  27.     }
  28.   }
  29.   theta += TWO_PI/frms;
  30.   //if (frameCount<frms) saveFrame("image-###.gif");
  31. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement