Merge branch 'master' of https://github.com/jackstah/SugarCubes into jackstah-master
[SugarCubes.git] / MarkSlee.pde
index 8c42a8c0aabac6a0ce82a7952b1f2a556b133803..8799b83d568e296e6d96439247501791b7386248 100644 (file)
@@ -368,6 +368,10 @@ class CrossSections extends SCPattern {
     addModulator(x).trigger();
     addModulator(y).trigger();
     addModulator(z).trigger();
+    addParams();
+  }
+  
+  protected void addParams() {
     addParameter(xr);
     addParameter(yr);
     addParameter(zr);    
@@ -388,11 +392,18 @@ class CrossSections extends SCPattern {
       z.setDuration(10000 - 9000*p.getValuef());
     }
   }
+  
+  float xv, yv, zv;
+  
+  protected void updateXYZVals() {
+    xv = x.getValuef();
+    yv = y.getValuef();
+    zv = z.getValuef();    
+  }
 
   public void run(int deltaMs) {
-    float xv = x.getValuef();
-    float yv = y.getValuef();
-    float zv = z.getValuef();    
+    updateXYZVals();
+    
     float xlv = 100*xl.getValuef();
     float ylv = 100*yl.getValuef();
     float zlv = 100*zl.getValuef();
@@ -452,7 +463,7 @@ class Blinders extends SCPattern {
         colors[p.index] = color(
           (hv + p.fz + p.fy*hs.getValuef()) % 360, 
           min(100, abs(p.fx - s.getValuef())/2.), 
-          max(0, 100 - mv/2. - mv * abs(i - 7.5))
+          max(0, 100 - mv/2. - mv * abs(i - (strip.metrics.length-1)/2.))
         );
         ++i;
       }