+ wavoff += deltaMs * .001;
+ for (int i = 0; i < wval.length; ++i) {
+ wval[i] = model.cy + 0.2 * model.yMax/2. * sin(wavoff + i / 1.9);
+ }
+ float sparklePos = (sparkleDirection ? sparkle.getValuef() : (1 - sparkle.getValuef())) * (Cube.POINTS_PER_STRIP)/2.;
+ float maxBright = sparkleBright * (1 - sparkle.getValuef());
+ for (Strip s : model.strips) {
+ int i = 0;
+ for (Point p : s.points) {
+ int wavi = (int) constrain(p.x / model.xMax * wval.length, 0, wval.length-1);
+ float wavb = max(0, wave.getValuef()*100. - 8.*abs(p.y - wval[wavi]));
+ colors[p.index] = color(
+ (lx.getBaseHuef() + .2*abs(p.x - model.cx) + .2*abs(p.y - model.cy)) % 360,
+ 100,
+ constrain(wavb + max(0, maxBright - 40.*abs(sparklePos - abs(i - (Cube.POINTS_PER_STRIP-1)/2.))), 0, 100)
+ );
+ ++i;
+ }
+ }
+