-
Notifications
You must be signed in to change notification settings - Fork 0
/
perlincolor.pde
107 lines (86 loc) · 2.94 KB
/
perlincolor.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
class PerlinColorRenderer extends AudioRenderer {
// Perlin Noise Demo - Jim Bumgardner
//dje mod
float kNoiseDetail = 0.001;
float r;
float speed= .01;
float ox = 400;
float oy = 400;
float cX = 0;
float cY = 0;
int rotations;
PerlinColorRenderer(AudioSource source) {
rotations = (int) source.sampleRate() / source.bufferSize();
}
void setup()
{
//size(256,256);
r = width/PI;
//noiseDetail(3,.6);
noiseDetail(2,.9);
colorMode(HSB, 1); //setupPixelPusher();
setcolorMode = 5;
vFader2 = 255;
vFader3 = 255;
vFader5 = 55;
}
synchronized void draw()
{
colorMode(HSB, 1);
//ox += max(-speed,min(speed,(mouseX-width/2)*speed/r));
//oy += max(-speed,min(speed,(mouseY-height/2)*speed/r));
ox += max(-speed,min(speed,(cX-width/2)*speed/r));
oy += max(-speed,min(speed,(cY-height/2)*speed/r));
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
//change colors
//setcolorMode
//set(x,y,color(.1-y*.1/height,4-v,.7+v*v));
float setcolorModeF = (float)map(setcolorMode, 0, 255, 0.08, .98);
float setSatModeF = (float)map(vFader2, 0, 255, 0, 1);
float setBrightModeF = (float)map(vFader3, 0, 255, 0, 1);
float setContrastModeF = (float)map(vFader4, 0, 255, 0, .6);
float setSpeedModeF = (float)map(vFader5, 0, 255, .00001, .0008);
float setNoiseDetailF = (float)map(vFader6, 0, 255, .001, .1);
//float v = noise(ox+x*kNoiseDetail,oy+y*kNoiseDetail,millis()*setSpeedModeF);
//float v = noise(ox+x*kNoiseDetail,oy+y*kNoiseDetail,millis()*.0001);
float v = noise(ox+x*(kNoiseDetail+setNoiseDetailF),oy+y*(kNoiseDetail+setNoiseDetailF),millis()*setSpeedModeF);
set(x,y,color((setcolorModeF+.1)-v,setSatModeF,(v*setContrastModeF+v)*setBrightModeF));
//set(x,y,color(setcolorModeF-y*.05/height,(4-v)*setSatModeF,(setContrastModeF+v*v)*setBrightModeF));
//set(x,y,color((setcolorModeF+.1)-v,setSatModeF,(v*setContrastModeF+v)*setBrightModeF));
}
}
colorMode(RGB,255);
//drawPixelPusher();
}
public void onClick(float mX, float mY) {
cX = mX * canvasW;
cY = mY * canvasH;
//int oX = (int)cX;
//int oY = (int)cY;
//ox += max(-speed,min(speed,(cX-width/2)*speed/r));
//oy += max(-speed,min(speed,(cY-height/2)*speed/r));
//move_clouds(oX, oY, 25, .25);
}
/*
void move_clouds(int i, int j, int r, float delta)
{
ox += max(-speed,min(speed,(ox-width/2)*speed/r));
oy += max(-speed,min(speed,(oy-height/2)*speed/r));
//ox += max(-speed,min(speed,(ox-width/2)*speed/r));
//oy += max(-speed,min(speed,(oy-height/2)*speed/r));
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
float v = noise(ox+x*kNoiseDetail,oy+y*kNoiseDetail,millis()*.0002);
//change colors
//setcolorMode
//set(x,y,color(.1-y*.1/height,4-v,.7+v*v));
set(x,y,color(.1-y*.1/height,4-v,.3+v*v));
}
}
}*/
}