X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TobySegaran.pde;h=8aaacb175ef7e7e67e0eb9ba0dd285ac3f14a28d;hb=8f4e6c99775f2724edf3cec488860eb68b06491c;hp=0358668ace2961afef76d33431ef44ebce1194f5;hpb=e608336bcb5738c848a6510ac54990dc9f193f69;p=SugarCubes.git diff --git a/TobySegaran.pde b/TobySegaran.pde index 0358668..8aaacb1 100644 --- a/TobySegaran.pde +++ b/TobySegaran.pde @@ -23,14 +23,14 @@ class GlitchPlasma extends SCPattern { } } - public void run(int deltaMs) { - for (Point p : model.points) { - float hv = sin(dist(p.fx + pos, p.fy, 128.0, 128.0) / 8.0) - + sin(dist(p.fx, p.fy, 64.0, 64.0) / 8.0) - + sin(dist(p.fx, p.fy + pos / 7, 192.0, 64.0) / 7.0) - + sin(dist(p.fx, p.fz + pos, 192.0, 100.0) / 8.0); + public void run(double deltaMs) { + for (LXPoint p : model.points) { + float hv = sin(dist(p.x + pos, p.y, 128.0, 128.0) / 8.0) + + sin(dist(p.x, p.y, 64.0, 64.0) / 8.0) + + sin(dist(p.x, p.y + pos / 7, 192.0, 64.0) / 7.0) + + sin(dist(p.x, p.z + pos, 192.0, 100.0) / 8.0); float bv = 100; - colors[p.index] = color((hv+2)*50, satu, bv); + colors[p.index] = lx.hsb((hv+2)*50, satu, bv); } if (random(1.0)45 || x%50<5) { intensity[x][ym-1] = random(30,100); @@ -81,9 +81,9 @@ class FireEffect extends SCPattern { } } - for (Point p : model.points) { - int x = max(0,(int(p.fx)+int(p.fz))%xm); - int y = constrain(ym-int(p.fy),0,ym-1); + for (LXPoint p : model.points) { + int x = max(0,(int(p.x)+int(p.z))%xm); + int y = constrain(ym-int(p.y),0,ym-1); colors[p.index] = flameColor(intensity[x][y]); } } @@ -111,18 +111,18 @@ class StripBounce extends SCPattern { } } - public void run(int deltaMs) { + public void run(double deltaMs) { float[] bright = new float[model.points.size()]; for (Strip strip : model.strips) { for (int i=0;ibright[p.index]) { - colors[p.index] = color(hv,sat[i].getValuef(),br); + colors[p.index] = lx.hsb(hv,sat[i].getValuef(),br); bright[p.index] = br; } } @@ -168,14 +168,14 @@ class SoundRain extends SCPattern { } } - public void run(int deltaMs) { + public void run(double deltaMs) { this.fft.forward(this.lx.audioInput().mix); for (int i = 0; i < avgSize; ++i) { float value = this.fft.getAvg(i); this.bandVals[i].setEndVal(value,40).trigger(); float lv = min(value*gain,100); if (lv>lightVals[i]) { - lightVals[i]=min(lightVals[i]+10,lv,100); + lightVals[i]=min(lightVals[i]+15,lv,100); } else { lightVals[i]=max(lv,lightVals[i]-5,0); } @@ -184,10 +184,10 @@ class SoundRain extends SCPattern { for (int j=0; jlightVals[i]) { + lightVals[i]=min(lightVals[i]+30,lv,model.yMax+10); + } else { + lightVals[i]=max(lv,lightVals[i]-10,0); + } + } + int i = 0; + for (Cube c : model.cubes) { + for (int j=0; javgSize) seq=avgSize-seq; + seq=constrain(seq,0,avgSize-1); + float br=max(0, lightVals[seq]-p.y); + colors[p.index] = lx.hsb((dis*avgSize*65)/model.xMax,90,br); + } + } + } + } + } } +