Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PGraphics cubeA, cubeB, cubeC;
- int frames = 240;
- float theta;
- void setup() {
- size(500, 500, P3D);
- cubeA = createGraphics(width, height, P3D);
- cubeB = createGraphics(width, height, P3D);
- cubeC = createGraphics(width, height, P3D);
- blendMode(DARKEST);
- }
- void draw() {
- background(255);
- drawCube(cubeA, 1, 2, #ffffff);
- drawCube(cubeB, 2, 1, #ffffff);
- drawCube(cubeC, 1, 1, #ffffff);
- image(cubeA, 0, 0);
- image(cubeB, 0, 0);
- image(cubeC, 0, 0);
- theta +=TWO_PI/frames;
- if (frameCount<=frames) saveFrame("image-###.tif");
- }
- void drawCube(PGraphics cube, float xd, float yd, color col) {
- cube.beginDraw();
- cube.lights();
- cube.clear();
- cube.noStroke();
- cube.fill(col);
- cube.translate(cube.width/2, cube.height/2);
- cube.rotateX(theta*xd);
- cube.rotateY(theta*yd);
- cube.box(cube.width/3);
- cube.endDraw();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement