Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import peasy.*;
- int num = 10, frms = 75, fc;
- int w = 200, h = w, d = h;
- float theta, step = 20, scal;
- boolean animate = false, save=false;
- PeasyCam cam;
- void setup() {
- size(540, 540, P3D);
- cam = new PeasyCam(this, 0, 0, 0, 200);
- cam.setMinimumDistance(50);
- cam.setMaximumDistance(1000);
- }
- void draw() {
- background(0);
- for (int x=-w/2; x<w/2; x += step) {
- for (int y=-h/2; y<h/2; y+= step) {
- for (int z= -d/2; z<d/2; z += step) {
- float offSet = map(y, -w/2, w/2, 0, PI);
- pushMatrix();
- scal = 1;
- if (animate) scal = map(sin(theta), -1, 1, 1, 1.5);
- translate(x*scal, y*scal, z*scal);
- box(step*.9);
- popMatrix();
- }
- }
- }
- if (save && frameCount <= fc + frms) saveFrame("/Volumes/Anim/image-###.gif");
- theta += TWO_PI/frms;
- }
- void keyPressed() {
- if (key == 'a') animate = true;
- if (key == 's') {
- fc = frameCount;
- save = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement