-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTrailers.pde
More file actions
64 lines (55 loc) · 1.19 KB
/
Trailers.pde
File metadata and controls
64 lines (55 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import java.util.UUID;
boolean running = true;
Sequence s = null;
boolean record = true;
boolean withFx = false;
boolean frameCounter = false;
Integer stopAfter = 2880;
void setup() {
//size(640,640,P3D);
fullScreen(P3D);
stroke(255,255,255,255/3);
fill(255);
setupFx();
background(0);
clear();
s = buildSequence();
}
PGraphics frameWithFx(boolean withFx, int width, int height) {
PGraphics frame = buildFrame(width, height);
if (withFx) {
return applyFx(frame);
} else {
return frame;
}
}
void draw() {
clear();
if (running) {
s.build();
}
PGraphics frame = frameWithFx(withFx, width, height);
image(frame, 0, 0);
if (record) {
saveFrame("animated/#####.png");
}
if (stopAfter != null && frameCount >= stopAfter) {
System.exit(1);
}
if (frameCounter) {
stroke(#FFFFFF);
text(String.format("%2d : %d : %d", frameCount % 60, frameCount / 30 % 4, frameCount / 30 / 4), 30, 30);
}
}
void save() {
saveImage(backdrop(frameWithFx(withFx, width*2,height*2)));
}
void keyPressed() {
switch (key) {
case ' ': running = !running;
break;
case 's': save();
break;
case 'f': withFx = ! withFx;
}
}