X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TestPatterns.pde;h=c247e2ca66f2eb3dff1a6a1c939dc0bde1c33ace;hb=186bc4d32747d985dccfde843992bb0b5bf428e6;hp=733494541ec28d1c5e6fce48ea7612007c2b1530;hpb=7b5af85a438e9ee13efcc2025ed6b0f11de48188;p=SugarCubes.git diff --git a/TestPatterns.pde b/TestPatterns.pde index 7334945..c247e2c 100644 --- a/TestPatterns.pde +++ b/TestPatterns.pde @@ -74,6 +74,35 @@ class TestZPattern extends SCPattern { } } +/** + * This shows how to iterate over towers, enumerated in the model. + */ +class TestTowerPattern extends SCPattern { + private final SawLFO towerIndex = new SawLFO(0, model.towers.size(), 1000*model.towers.size()); + + public TestTowerPattern(GLucose glucose) { + super(glucose); + addModulator(towerIndex).trigger(); + towerIndex.setValue(9); + } + + public void run(int deltaMs) { + println((int)towerIndex.getValuef()); + int ti = 0; + for (Tower t : model.towers) { + for (Point p : t.points) { + colors[p.index] = color( + lx.getBaseHuef(), + 100, + max(0, 100 - 80*abs(ti - towerIndex.getValuef())) + ); + } + ++ti; + } + } + +} + /** * This is a demonstration of how to use the projection library. A projection * creates a mutation of the coordinates of all the points in the model, creating