Advertisement
xeromino

mobile

Oct 7th, 2017
265
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import com.hamoid.*;
  2.  
  3. import peasy.*;
  4. import peasy.org.apache.commons.math.*;
  5. import peasy.org.apache.commons.math.geometry.*;
  6.  
  7. color bg, f;
  8. float theta;
  9. int frms = 500;
  10. long rs;
  11.  
  12. color black = color(34, 34, 34); // #222222
  13. color white = color(238, 238, 238); // #EEEEEE
  14. color red = color(225, 76, 69); // #E14C45
  15.  
  16. PeasyCam cam;
  17. VideoExport videoExport;
  18.  
  19. void setup() {
  20.   size(1080, 720, P3D);
  21.   smooth(8);
  22.   background(0);
  23.   bg = #eeeeee; // #222222;
  24.   f = #764f6f; //#eeeeee;
  25.  
  26.   rs = (long) random(9999);
  27.  
  28.   cam = new PeasyCam(this, width/2, height/2, 0, 1300);
  29.   cam.setMinimumDistance(50);
  30.   cam.setMaximumDistance(1500);
  31.   ///*
  32.   videoExport = new VideoExport(this, "internetVideo.mp4");
  33.   videoExport.setFrameRate(30);
  34.   videoExport.setQuality(85, 128);
  35.   videoExport.startMovie();
  36.  
  37.   frameRate(30);
  38.  
  39.   curveDetail(40);
  40. }
  41.  
  42. void draw() {
  43.   background(black);
  44.   randomSeed(rs);
  45.   lights();
  46.   translate(width/2, height/2);
  47.   pushMatrix();
  48.   rotateY(theta);
  49.  
  50.   println(frameRate);
  51.  
  52.   int num = 75;
  53.   for (int i=0; i<num; i++) {
  54.     //noFill();
  55.     fill(white);
  56.     if (random(1)>0.9) fill(red);
  57.     stroke(black, 100);
  58.     float p[] = new float[12];
  59.     for (int j=0; j<p.length; j++) {
  60.       p[j] = random(-400,400);
  61.     }
  62.     curve(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11]);  
  63.   }
  64.   popMatrix();
  65.  
  66.   //videoExport.saveFrame();
  67.   //if (frameCount<=frms) saveFrame("image-####.gif");
  68.  
  69.   if (frameCount<=frms) videoExport.saveFrame();
  70.   if (frameCount>frms) videoExport.endMovie();
  71.  
  72.   theta += TWO_PI/frms;
  73. }
  74.  
  75.  
  76. void keyPressed() {
  77.   if (key == 'q') {
  78.     videoExport.endMovie();
  79.     exit();
  80.   }
  81. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement