forked from mhenstell/acw
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathColorDrop.pde
59 lines (44 loc) · 1.39 KB
/
ColorDrop.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
class ColorDrop extends Routine {
void draw() {
draw.background(0);
float frame_mult = 3; // speed adjustment
// lets add some jitter
modeFrameStart = modeFrameStart - min(0,int(random(-5,12)));
long frame = frameCount - modeFrameStart;
for(int row = 0; row < Config.HEIGHT; row++) {
float phase = sin((float)((row+frame*frame_mult)%Config.HEIGHT)/Config.HEIGHT*3.146 + random(0,.6));
float r = 0;
float g = 0;
float b = 0;
if((row+frame*frame_mult)%(3*Config.HEIGHT) < Config.HEIGHT) {
r = red(primaryColor)* phase;
g = green(primaryColor) * phase;
b = blue(primaryColor) * phase;
// r = 255*phase;
// g = 0;
// b = 0;
}
else if((row+frame*frame_mult)%(3*Config.HEIGHT) < Config.HEIGHT*2) {
r = red(secondaryColor)* phase;
g = green(secondaryColor) * phase;
b = blue(secondaryColor) * phase;
// r = 0;
// g = 255*phase;
// b = 0;
}
else {
r = red(tertiaryColor)* phase;
g = green(tertiaryColor) * phase;
b = blue(tertiaryColor) * phase;
// r = 0;
// g = 0;
// b = 255*phase;
}
draw.stroke(r,g,b);
draw.line(0, row, Config.WIDTH, row);
}
if (frame >Config.FRAMERATE*Config.MODE_TIMEOUT) {
newMode();
}
}
}