-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCoreScenes.pde
90 lines (76 loc) · 1.91 KB
/
CoreScenes.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
88
89
90
// ========================= Core Example Scenes ============
/*
Example scene for showing an intro text and fading out
*/
class coreIntro extends Scene {
coreIntro(SceneTime[] times) {
super("coreIntro",times); // Active first 10 seconds
}
void draw() {
textFont(font);
textAlign(CENTER);
float opacity = 100 - durationPercentage();
fill(110,110,110, opacity);
text( "Music: Zaagstof", width/2, height/2 - 100);
text( "Visuals: Jan den Besten", width/2, height/2 + 100 );
}
}
/*
Example scene for showing a wave
*/
class coreWave extends Scene {
int x,w,y,h;
coreWave(SceneTime[] times) {
super("coreWave",times); // Active all the time
}
void setup() {
x = 0;
w = width;
y = 0;
h = height;
}
void draw() {
stroke(0,0,0);
int yl = y + h/2;
int yh = h/2;
for(int i = 0; i < player.bufferSize() - 1; i++)
{
float x1 = map( i, 0, player.bufferSize(), x, w );
float x2 = map( i+1, 0, player.bufferSize(), x, w );
line( x1, yl + player.mix.get(i)*yh, x2, yl + player.mix.get(i+1)*yh );
}
}
}
/*
Example scene for showing an outro text and fading in
*/
class coreOutro extends Scene {
coreOutro(SceneTime[] times) {
super("coreOutro",times);
}
void draw() {
textFont(font);
textAlign(CENTER);
float opacity = durationPercentage() * 2;
if (opacity>100) {
opacity = 100 - opacity/2;
}
fill(128,128,128, opacity);
text( "Music: Zaagstof", width/2, height/2 - 100);
text( "Visuals: Jan den Besten", width/2, height/2 + 100 );
}
}
/*
Example scene for a simple fade out at the end
*/
class coreFadeOut extends Scene {
coreFadeOut(SceneTime[] times) {
super("coreFadeOut",times);
}
void draw() {
float percentage = map2(durationPercentage(), 0,100,0,100, EXPONENTIAL, EASE_IN_OUT);
fill(128,128,128,percentage);
noStroke();
rect(0,0,width, height);
}
}