-
Notifications
You must be signed in to change notification settings - Fork 0
/
video_destroyNOSOUND.pde
87 lines (74 loc) · 1.51 KB
/
video_destroyNOSOUND.pde
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import processing.video.*;
import processing.sound.*;
//PRESS SPACE ONCE TO PLAY
//OPTIONS
int pixelSize = 2;
boolean whiteBG = false;
//OPTIONS END
Movie video;
Movie back;
color black = #000000;
int clearInt = 0;
void setup() {
size(950,600,P3D);
frameRate(30);
if (whiteBG == true) {
background(#FFFFFF);
}
//load VOID
video = new Movie(this, "gradient.mp4");
}
void draw() {
if (whiteBG == true) {
background(#FFFFFF);
}
//clearInt decides if clear
if (int(random(30)) == 9) {
clearInt += 1;
}
if (clearInt%2 == 0) {
//clear();
if (whiteBG == true) {
background(#FFFFFF);
}
}
//video behind
image(video, width/4-72+10, height/4-45+12+3);
addFilter();
//saveFrame("frames/frame-#########.png");
}
void addFilter() {
video.loadPixels();
for (int x = 0; x < video.width; x++) {
for (int y = 0; y < video.height; y++) {
int loc = x + y * video.width;
color currentColor = video.pixels[loc];
float z = brightness(video.pixels[loc]);
if (z > 200) {
z = 200;
//z = 100;
//z = 50;
}
if (z < 10) {
z = -10;
}
pushMatrix();
translate(x+10,y+12,z);
fill(currentColor);
noStroke();
//rect(260, 190, pixelSize,pixelSize);
rect(150, 110, pixelSize,pixelSize);
popMatrix();
}
}
video.updatePixels();
}
void movieEvent(Movie video) {
//updates video
video.read();
}
void keyPressed() {
if(key == ' '){
video.play();
}
}