From 821ceae95aca73def4a6d5abc36e0065895cfa37 Mon Sep 17 00:00:00 2001 From: Toby Segaran Date: Wed, 14 Aug 2013 19:03:37 -0700 Subject: [PATCH] Cleanup of various patterns, expanded colors --- SugarCubes.pde | 3 ++- TobySegaran.pde | 53 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 45 insertions(+), 11 deletions(-) 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