sinesphere working with notes
[SugarCubes.git] / MarkSlee.pde
index bcd5c62c81898b82240a6c075f8f151555587fbb..d3237e1e64fb2204e0ee6a41950ad80855e3d9cd 100644 (file)
@@ -57,10 +57,10 @@ class Cathedrals extends SCPattern {
       if (abs(p.x - cx) < arm) {
         d = min(abs(p.x - cx), abs(p.y - middle));
       }
-      colors[p.index] = color(
+      colors[p.index] = lx.hsb(
         (lx.getBaseHuef() + .2*abs(p.y - model.cy)) % 360,
         min(100, sf*dist(abs(p.x - cx), p.y, arm, middle)),
-        max(0, 120 - d*falloff));
+        constrain(120 - d*falloff, 0, 100));
     }
   } 
 }
@@ -110,7 +110,7 @@ class MidiMusic extends SCPattern {
       }
       float posf = position.getValuef();
       for (Point p : model.points) {
-        colors[p.index] = blendColor(colors[p.index], color(
+        colors[p.index] = blendColor(colors[p.index], lx.hsb(
           (lx.getBaseHuef() + .2*abs(p.x - model.cx) + .2*abs(p.y - model.cy)) % 360,
           100,
           max(0, bright - posf*100 - falloff*abs(p.y - posf*model.yMax))
@@ -255,7 +255,7 @@ class MidiMusic extends SCPattern {
       for (Point p : s.points) {
         int wavi = (int) constrain(p.x / model.xMax * wval.length, 0, wval.length-1);
         float wavb = max(0, wave.getValuef()*100. - 8.*abs(p.y - wval[wavi]));
-        colors[p.index] = color(
+        colors[p.index] = lx.hsb(
           (lx.getBaseHuef() + .2*abs(p.x - model.cx) + .2*abs(p.y - model.cy)) % 360,
           100,
           constrain(wavb + max(0, maxBright - 40.*abs(sparklePos - abs(i - (Cube.POINTS_PER_STRIP-1)/2.))), 0, 100)
@@ -684,10 +684,11 @@ class Swarm extends SCPattern {
         colors[p.index] = lx.hsb(
         (lx.getBaseHuef() + 0.3 * abs(p.x - hOffX.getValuef())) % 360, 
         constrain(80 + 40 * fV, 0, 100), 
-        constrain(100 - (30 - fV * falloff.getValuef()) * modDist(i + (s*63)%61, offset.getValuef() * strip.metrics.numPoints, strip.metrics.numPoints), 0, 100)
+        constrain(100 - 
+          (30 - fV * falloff.getValuef()) * modDist(i + (s*63)%61, offset.getValuef() * strip.metrics.numPoints, strip.metrics.numPoints), 0, 100)
           );
         ++i;
-      }
+      } 
       ++s;
     }
   }
@@ -1411,7 +1412,7 @@ class ColorFuckerEffect extends SCEffect {
     float bMod = level.getValuef();
     float sMod = 1 - desat.getValuef();
     float hMod = hueShift.getValuef();
-    float fSharp = 1/(1.0001-sharp.getValuef());
+    float fSharp = sharp.getValuef();
     float fSoft = soft.getValuef();
     boolean mon = mono.getValuef() > 0.5;
     boolean ivt = invert.getValuef() > 0.5;
@@ -1425,7 +1426,12 @@ class ColorFuckerEffect extends SCEffect {
           hsb[2] = 1 - hsb[2];
         }
         if (fSharp > 0) {
-          hsb[2] = hsb[2] < .5 ? pow(hsb[2],fSharp) : 1-pow(1-hsb[2],fSharp);
+          fSharp = 1/(1-fSharp);
+          if (hsb[2] < .5) {
+            hsb[2] = pow(hsb[2],fSharp);
+          } else {
+            hsb[2] = 1-pow(1-hsb[2],fSharp);
+          }
         }
         if (fSoft > 0) {
           if (hsb[2] > 0.5) {