Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PGraphics cube;
- float theta;
- int frames = 300;
- void setup() {
- size(500, 500, P3D);
- cube = createGraphics(100, 100, P3D);
- }
- void draw() {
- background(0);
- drawCube();
- for (int x=0; x<width; x+=cube.width) {
- for (int y=0; y<height; y+=cube.height) {
- image(cube, x, y);
- }
- }
- if (frameCount<=frames) saveFrame("image-###.gif");
- }
- void drawCube() {
- cube.beginDraw();
- cube.lights();
- cube.background(0);
- cube.noStroke();
- cube.pushMatrix();
- cube.translate(cube.width/2, cube.height/2);
- //cube.rotateX(frameCount/100.0);
- //cube.rotateY(frameCount/200.0);
- cube.rotateX(theta*2);
- cube.rotateY(theta*1);
- cube.box(cube.width/2);
- cube.popMatrix();
- cube.endDraw();
- theta += TWO_PI/frames;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement