Advertisement
xeromino

blob3d

Jul 27th, 2017
916
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import peasy.*;
  2. import peasy.org.apache.commons.math.*;
  3. import peasy.org.apache.commons.math.geometry.*;
  4.  
  5. PeasyCam cam;
  6. float theta;
  7. int num = 150;
  8. int frms = 200;
  9.  
  10. void setup() {
  11.   size(540, 540, P3D);
  12.   smooth(8);
  13.   background(0);
  14.  
  15.   cam = new PeasyCam(this, width/2, height/2, 0, 800);
  16.   cam.setMinimumDistance(50);
  17.   cam.setMaximumDistance(1000);
  18.  
  19. }
  20.  
  21. void draw() {
  22.   background(#E9D3AF);
  23.   strokeWeight(1);
  24.   stroke(255, 15);
  25.   lights();
  26.   translate(width/2, height/2, -100);
  27.  
  28.   for (int i=0; i<num; i++) {
  29.     float y = map(i, 0, num, -height*.65, height*.65);
  30.     float offSet = TWO_PI/num*i;
  31.     float boxSize = map(sin(theta+offSet*2), -1, 1, 30, 100);
  32.     float x = map(sin(theta+offSet*1), -1, 1, -150, 150);
  33.     pushMatrix();
  34.     translate(x, y);
  35.     fill(#41A3A3);
  36.     stroke(#E9D3AF);
  37.     noStroke();
  38.     sphere(boxSize);
  39.     popMatrix();
  40.   }
  41.  
  42.   println(frameRate);
  43.  
  44.   //videoExport.saveFrame();
  45.  
  46.   if (frameCount<=frms) saveFrame("image-####.gif");
  47.  
  48.   theta += TWO_PI/frms;
  49. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement