Skip to content

Commit

Permalink
Make test patterns more useful
Browse files Browse the repository at this point in the history
  • Loading branch information
l8on committed Jul 29, 2017
1 parent e0ae2cb commit f9529b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion L8on.pde
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public class HeartsBeat extends LEDomePattern {
public void resetHeartSaturation(int i) {
this.heartSaturations[i].setPeriod(getRate());
this.heartSaturations[i].setBasis(random(0.02, 0.15));
this.heartSaturations[i].start(); //<>//
this.heartSaturations[i].start(); //<>// //<>//
}

public void run(double deltaMs) {
Expand Down
2 changes: 1 addition & 1 deletion L8onUtil.pde
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public class SnakeLayer extends LXLayer {
float distToTravel = dist(firstHeadPoint.x, firstHeadPoint.y, firstHeadPoint.z, secondHeadPoint.x, secondHeadPoint.y, secondHeadPoint.z);
return max(distToTravel / (snakeSpeed.getValuef() / SECONDS), 0.0);
}
} //<>//
} //<>// //<>//

/*
* A container to keep state of the different 3d waves in the color remix.
Expand Down
14 changes: 11 additions & 3 deletions TestPatterns.pde
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,26 @@ public class HueTestPattern extends LXPattern {

public class FaceIteratorTest extends LEDomePattern {
private final SawLFO currIndex = new SawLFO(0, ((LEDome)model).faces.size(), ((LEDome)model).faces.size() * 300);
private final BoundedParameter selectedFace = new BoundedParameter("SEL", 0, 0, ((LEDome)model).faces.size() - 1);

public FaceIteratorTest(LX lx) {
super(lx);

addParameter(selectedFace);
addModulator(currIndex).start();
}

public void run(double deltaMs) {
int index = (int) currIndex.getValuef();
int selectedIndex = (int) selectedFace.getValuef();

for(int i = 0; i < model.faces.size(); i++) {
LEDomeFace face = model.faces.get(i);
if(!face.hasLights()) {
continue;
continue;
}

float bv = (i == index) ? 100.0 : 0.0;
float bv = (i == index || i == selectedIndex) ? 100.0 : 0.0;

for(LXPoint p : face.points) {
colors[p.index] = LX.hsb(120, 90, bv);
Expand All @@ -51,19 +55,23 @@ public class FaceIteratorTest extends LEDomePattern {

class EdgeIteratorTest extends LEDomePattern {
private final SawLFO currIndex = new SawLFO(0, ((LEDome)model).edges.size(), ((LEDome)model).edges.size() * 200);
private final BoundedParameter selectedEdge = new BoundedParameter("SEL", 0, 0, ((LEDome)model).edges.size() - 1);

public EdgeIteratorTest(LX lx) {
super(lx);

addParameter(selectedEdge);
addModulator(currIndex).start();
}

public void run(double deltaMs) {
int index = (int) currIndex.getValuef();
int selectedIndex = (int) selectedEdge.getValuef();
LEDomeEdge edge = this.model.edges.get(index);
LEDomeEdge selectedEdge = this.model.edges.get(selectedIndex);

for(LXPoint p : model.points) {
float bv = edge.onEdge(p) ? 100.0 : 0.0;
float bv = (edge.onEdge(p) || selectedEdge.onEdge(p)) ? 100.0 : 0.0;
colors[p.index] = LX.hsb(120, 90, bv);
}
}
Expand Down

0 comments on commit f9529b4

Please sign in to comment.