animation/left_right_spacing/left_right_spacing.pde

52 lines
990 B
Plaintext
Raw Normal View History

PImage img;
import processing.svg.*;
float EYE_INC = 0.25;
float EYE_MAX = 8.0;
float EYE = 3.0;
void settings() {
System.setProperty("jogl.disable.openglcore", "false");
size(900, (900 / 4) * 3, P3D);
}
void setup() {
noFill();
strokeWeight(2);
textMode(SHAPE);
}
void drawBox (int x, int y, int z) {
push();
translate(x, y, z);
rotateY(radians( 60 ));
box(45);
pop();
}
void draw() {
clear();
background(#ffffff);
camera(70.0 + (EYE / 2), 35.0, 120.0, 50.0, 50.0, 35.0 / 2,
0.0, 1.0, 0.0);
beginRaw(SVG, "left_spacing_" + str(EYE) + ".svg");
stroke(255, 0, 0, 124);
drawBox(50, 50, 0);
endRaw();
camera(70.0 - (EYE / 2), 35.0, 120.0, 50.0, 50.0, 35.0 / 2,
0.0, 1.0, 0.0);
//background(#ffffff);
beginRaw(SVG, "right_spacing_" + str(EYE) + ".svg");
stroke(0, 0, 255, 124);
drawBox(50, 50, 0);
endRaw();
save("left_right_spacing_" + str(EYE) + ".png");
if (EYE == EYE_MAX) {
exit();
}
EYE += EYE_INC;
}