From: Toby Segaran Date: Thu, 15 Aug 2013 02:03:37 +0000 (-0700) Subject: Cleanup of various patterns, expanded colors X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=821ceae95aca73def4a6d5abc36e0065895cfa37;p=SugarCubes.git Cleanup of various patterns, expanded colors --- diff --git a/SugarCubes.pde b/SugarCubes.pde index 1aac8c9..8a8b46b 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -40,7 +40,8 @@ LXPattern[] patterns(GLucose glucose) { new GlitchPlasma(glucose), new FireEffect(glucose), new StripBounce(glucose), - new SoundCubes(glucose), + new SoundRain(glucose), + new FaceSync(glucose), // Basic test patterns for reference, not art new TestCubePattern(glucose), diff --git a/TobySegaran.pde b/TobySegaran.pde index a46ef4a..fd4a442 100644 --- a/TobySegaran.pde +++ b/TobySegaran.pde @@ -30,7 +30,7 @@ class GlitchPlasma extends SCPattern { + 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); float bv = 100; - colors[p.index] = color((hv+2)*25, satu, bv); + colors[p.index] = color((hv+2)*50, satu, bv); } if (random(1.0)bright[p.index]) { @@ -131,7 +131,7 @@ class StripBounce extends SCPattern { } } -class SoundCubes extends SCPattern { +class SoundRain extends SCPattern { private FFT fft = null; private LinearEnvelope[] bandVals = null; @@ -139,7 +139,7 @@ class SoundCubes extends SCPattern { private int avgSize; SawLFO pos = new SawLFO(0, 9, 8000); - public SoundCubes(GLucose glucose) { + public SoundRain(GLucose glucose) { super(glucose); addModulator(pos).trigger(); } @@ -164,21 +164,54 @@ class SoundCubes extends SCPattern { float value = this.fft.getAvg(i); this.bandVals[i].setEndVal(value,40).trigger(); float lv = min(value*25,100); - if (lv>lightVals[i]-6) { - lightVals[i]=lv; + if (lv>lightVals[i]) { + lightVals[i]=min(lightVals[i]+10,lv,100); } else { - lightVals[i]=lightVals[i]-6; + lightVals[i]=max(lv,lightVals[i]-5,0); } } for (int i=0; i