- for (Point p : model.points) {
- float bv = max(0, 100 - abs(p.fz - zPos.getValuef()));
- colors[p.index] = color(hv, 100, bv);
+ for (LXPoint p : model.points) {
+ float bv = max(0, 100 - abs(p.z - zPos.getValuef()));
+ colors[p.index] = lx.hsb(hv, 100, bv);
+ }
+ }
+}
+
+/**
+ * This shows how to iterate over towers, enumerated in the model.
+ */
+class TestTowerPattern extends TestPattern {
+ private final SawLFO towerIndex = new SawLFO(0, model.towers.size(), 1000*model.towers.size());
+
+ public TestTowerPattern(LX lx) {
+ super(lx);
+ addModulator(towerIndex).trigger();
+ }
+
+ public void run(double deltaMs) {
+ int ti = 0;
+ for (Tower t : model.towers) {
+ for (LXPoint p : t.points) {
+ colors[p.index] = lx.hsb(
+ lx.getBaseHuef(),
+ 100,
+ max(0, 100 - 80*LXUtils.wrapdistf(ti, towerIndex.getValuef(), model.towers.size()))
+ );
+ }
+ ++ti;