Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.hamoid.*;
- import peasy.*;
- import peasy.org.apache.commons.math.*;
- import peasy.org.apache.commons.math.geometry.*;
- int frms = 180;
- float sz = 20;
- float theta = 0, ns, nx, ny, nz;
- color bg, f;
- PeasyCam cam;
- VideoExport videoExport;
- void setup() {
- size(1080, 720, P3D);
- smooth(8);
- background(0);
- colorMode(HSB, 360, 100, 100);
- f = #222222;
- bg = #eeeeee;
- cam = new PeasyCam(this, width/2, height/2, 0, 1300);
- cam.setMinimumDistance(50);
- cam.setMaximumDistance(1500);
- ///*
- videoExport = new VideoExport(this, "internetVideo.mp4");
- videoExport.setFrameRate(45);
- videoExport.setQuality(85, 128);
- videoExport.startMovie();
- //*/
- frameRate(45);
- }
- void draw() {
- background(bg);
- randomSeed(1234);
- lights();
- translate(width/2, height/2);
- cubeCircle(50, width/2, 1, 3);
- cubeCircle(30, width/4, -1, 2);
- videoExport.saveFrame();
- //if (frameCount<=frms) saveFrame("image-####.gif");
- theta += TWO_PI/frms;
- }
- void cubeCircle(int num, int d, int dir, int r) {
- if (dir == 1) {
- rotateY(frameCount/100.0);
- } else {
- rotateX(frameCount/100.0);
- }
- for (int i=0; i<num; i++) {
- float angle = TWO_PI/num*i;
- float x = cos(angle)*d;
- float y = sin(angle)*d;
- sz = map(sin(angle*r+theta), -1, 1, 25, 75);
- pushMatrix();
- translate(x, y, 0);
- //rotate(theta+angle*dir);
- rotateX(frameCount/100.0+angle*dir);
- rotateY(frameCount/100.0-angle*dir);
- fill(f);
- if (random(1)>.8) fill(#E14C45);
- stroke(bg);
- box(sz);
- popMatrix();
- }
- }
- void keyPressed() {
- if (key == 'q') {
- videoExport.endMovie();
- exit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement