Tweaking strip stuff and some anims
[SugarCubes.git] / TestPatterns.pde
index 14572a261a00aed742cde23da645fe14d082f94d..6a2747a3f86de5c8d201d74f1825bc1d4b0032df 100644 (file)
@@ -5,6 +5,24 @@ abstract class TestPattern extends SCPattern {
   }
 }
 
+class TestStripPattern extends TestPattern {
+  public TestStripPattern(GLucose glucose) {
+    super(glucose);
+  }
+  
+  public void run(int deltaMs) {
+    for (Strip s : model.strips) {
+      for (Point p : s.points) {
+        colors[p.index] = color(
+          lx.getBaseHuef(),
+          100,
+          max(0, 100 - 10*dist(p.x, p.y, s.cx, s.cy))
+        );
+      }
+    }
+  }
+}
+
 /**
  * Simplest demonstration of using the rotating master hue.
  * All pixels are full-on the same color.
@@ -343,15 +361,13 @@ class MappingTool extends TestPattern {
   }
   
   public void incStrip() {
-    int stripsPerCube = Cube.FACES_PER_CUBE * Face.STRIPS_PER_FACE;
-    stripIndex = (stripIndex + 1) % stripsPerCube;
+    stripIndex = (stripIndex + 1) % Cube.STRIPS_PER_CUBE;
   }
   
   public void decStrip() {
-    int stripsPerCube = Cube.FACES_PER_CUBE * Face.STRIPS_PER_FACE;
     --stripIndex;
     if (stripIndex < 0) {
-      stripIndex += stripsPerCube;
+      stripIndex += Cube.STRIPS_PER_CUBE;
     }
   }