-
Notifications
You must be signed in to change notification settings - Fork 0
/
simplegradient.pde
110 lines (88 loc) · 2 KB
/
simplegradient.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* By Lighting Organism */
int t=0;
int tScale = 1;
int type = 0;
int speed = 50;
boolean invert = false;
class simplegradientRenderer extends AudioRenderer {
int rotations;
simplegradientRenderer(AudioSource source) {
//rotations = (int) source.sampleRate() / source.bufferSize();
}
boolean toggle = true;
boolean invert = false;
void setup() {
size(canvasW, canvasH);
colorMode(HSB, 255);
// speed = (int)map(speed,0,255,245,265);
}
void draw() {
tScale = (int)map(vFader4, 0, 255, 1, 100);
if (mousePressed && (mouseButton == LEFT)){
type++;
if (type > 1){
type=0;
}
}
switch(type){
case 0:
for (int i=0; i<width; i++) {
speed = (int)map(vFader5, 0, 255, 0, 10);
if (invert == false) {
t+=tScale;
if (t >= speed) {
invert = true;
}
}
else {
t-=tScale;
if (t <= 0) {
invert = false;
}
}
//float val = map(t, width, 255, 0, 255);
stroke(t+setcolorMode,vFader2,vFader3-t);
line(i, 0, i, height);
}
break;
case 1:
for (int i=0; i<height; i++) {
//speed = (int)map(mouseY, 0, height, 245, 265);
speed = (int)map(vFader5, 0, 255, 0, 10);
if (invert == false) {
t+=tScale;
if (t >= speed) {
invert = true;
}
}
else {
t-=tScale;
if (t <= 0) {
invert = false;
}
}
//float val = map(t, width, 255, 0, 255);
stroke(setcolorMode,vFader2,t-vFader3);
line(0, i, width, i);
}
break;
}
}
public void directiontoggle(float oscToggle) {
//int mI = (int)placeholder;
if (oscToggle == 1) {
toggle = false;
type++;
if (type > 1){
type=0;
}
}
if (oscToggle == 0){
toggle = true;
type++;
if (type > 1){
type=0;
}
}
}
}