Advertisement
xeromino

creation

Oct 28th, 2015
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. float xOff, yOff, zOff;
  2. int step = 5;
  3. PGraphics pg;
  4.  
  5. void setup() {
  6.   size(540, 540, P2D);
  7.   pg = createGraphics(width, height, P2D);
  8. }
  9.  
  10. void draw() {
  11.   background(255);
  12.   xOff=0;
  13.   for (int x=0; x<width; x+=step) {
  14.     yOff=0;
  15.     xOff += 0.05;
  16.     for (int y=0; y<width; y+=step) {
  17.       float ns = noise(xOff,yOff, zOff);
  18.       float sz = map(ns, 0, 1, 0, step*2);
  19.       noStroke();
  20.       fill(0);
  21.       if (ns<0.6)fill(255, 100, 0);
  22.       if (ns>0.5) ellipse(x, y, sz, sz);
  23.       yOff += 0.03;
  24.     }
  25.   }
  26.   createMask();
  27.   blend(pg,0,0,width, height, 0,0,width, height, MULTIPLY);
  28.   zOff += 0.025;
  29.   if (frameCount<=200) saveFrame("/Volumes/Anim/image-###.gif");
  30. }
  31.  
  32. void createMask() {
  33.   float sz = width*.75;
  34.   pg.beginDraw();
  35.   pg.background(0);
  36.   pg.fill(255);
  37.   pg.noStroke();
  38.   pg.ellipse(width/2,height/2,sz,sz);
  39.   pg.endDraw();
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement