1 class TestHuePattern extends SCPattern {
2 public TestHuePattern(GLucose glucose) {
5 public void run(int deltaMs) {
6 for (int i = 0; i < colors.length; ++i) {
7 colors[i] = color(lx.getBaseHuef(), 100, 100);
12 class TestXPattern extends SCPattern {
13 private SinLFO xPos = new SinLFO(0, model.xMax, 4000);
14 public TestXPattern(GLucose glucose) {
16 addModulator(xPos).trigger();
18 public void run(int deltaMs) {
19 for (Point p : model.points) {
20 colors[p.index] = color(
23 max(0, 100 - abs(p.fx - xPos.getValuef()))
29 class TestYPattern extends SCPattern {
30 private SinLFO yPos = new SinLFO(0, model.yMax, 4000);
31 public TestYPattern(GLucose glucose) {
33 addModulator(yPos).trigger();
35 public void run(int deltaMs) {
36 for (Point p : model.points) {
37 colors[p.index] = color(
40 max(0, 100 - abs(p.fy - yPos.getValuef()))
46 class TestZPattern extends SCPattern {
47 private SinLFO zPos = new SinLFO(0, model.zMax, 4000);
48 public TestZPattern(GLucose glucose) {
50 addModulator(zPos).trigger();
52 public void run(int deltaMs) {
53 for (Point p : model.points) {
54 colors[p.index] = color(
57 max(0, 100 - abs(p.fz - zPos.getValuef()))
63 class TestProjectionPattern extends SCPattern {
65 final Projection projection;
66 final SawLFO angle = new SawLFO(0, TWO_PI, 9000);
67 final SinLFO yPos = new SinLFO(-20, 40, 5000);
69 TestProjectionPattern(GLucose glucose) {
71 projection = new Projection(model);
72 addModulator(angle).trigger();
73 addModulator(yPos).trigger();
76 public void run(int deltaMs) {
77 // Note: logically, you typically apply the transformations in reverse order
78 projection.reset(model)
79 .translate(-model.xMax/2., -model.yMax/2. + yPos.getValuef(), -model.zMax/2.)
80 .rotate(angle.getValuef(), 1, 0, 0)
83 for (Coord c : projection) {
84 float d = sqrt(c.x*c.x + c.y*c.y + c.z*c.z); // distance from origin
85 // d = abs(d-60) + max(0, abs(c.z) - 20); // life saver / ring thing
86 d = max(0, abs(c.y) - 10 + .3*abs(c.z) + .08*abs(c.x)); // plane / spear thing
87 colors[c.index] = color(
88 (lx.getBaseHuef() + .6*abs(c.x) + abs(c.z)) % 360,
90 constrain(140 - 10*d, 0, 100)