From b4aaf4e4026e0ecc81b8d18ae4afdc65d89ab63a Mon Sep 17 00:00:00 2001 From: Toby Segaran Date: Sat, 10 Aug 2013 15:25:24 -0700 Subject: [PATCH] Added bouncing cubes --- SugarCubes.pde | 1 + TobySegaran.pde | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/SugarCubes.pde b/SugarCubes.pde index 9831242..63dd033 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -36,6 +36,7 @@ LXPattern[] patterns(GLucose glucose) { new PianoKeyPattern(glucose), new WarmPlasma(glucose), new FireEffect(glucose), + new StripBounce(glucose), //new SineSphere(glucose), // Basic test patterns for reference, not art diff --git a/TobySegaran.pde b/TobySegaran.pde index b41c34c..5735cc3 100644 --- a/TobySegaran.pde +++ b/TobySegaran.pde @@ -89,3 +89,53 @@ class FireEffect extends SCPattern { } } +class StripBounce extends SCPattern { + private final int numOsc = 30; + SinLFO[] fX = new SinLFO[numOsc]; //new SinLFO(0, model.xMax, 5000); + SinLFO[] fY = new SinLFO[numOsc]; //new SinLFO(0, model.yMax, 4000); + SinLFO[] fZ = new SinLFO[numOsc]; //new SinLFO(0, model.yMax, 3000); + SinLFO[] sat = new SinLFO[numOsc]; + float[] colorOffset = new float[numOsc]; + + public StripBounce(GLucose glucose) { + super(glucose); + for (int i=0;ibright[p.index]) { + colors[p.index] = color(hv,sat[i].getValuef(),br); + bright[p.index] = br; + } + } + } + } + for (Point p : model.points) { + if (bright[p.index]==0) { + colors[p.index]=color(0,0,0); + } + } + } +} -- 2.34.1