Add mask transition to do MULTIPLY burn on crossfader
[SugarCubes.git] / MarkSlee.pde
index a67f719de99eadc90367791df291c75149e682d9..7e0f46f279eb8e59ff941d83a84d05dda72a7b22 100644 (file)
@@ -128,6 +128,34 @@ class SwipeTransition extends SCTransition {
   }
 }
 
+class MaskTransition extends SCTransition {
+  
+  MaskTransition(GLucose glucose) {
+    super(glucose);
+  }
+
+  void computeBlend(int[] c1, int[] c2, double progress) {
+    if (progress < 0.5) {
+      for (int i = 0; i < c1.length; ++i) {
+        colors[i] = lerpColor(
+          c1[i],
+          blendColor(c1[i], c2[i], MULTIPLY),
+          (float) (2.*progress),
+          RGB);
+      }
+    } else {
+      for (int i = 0; i < c1.length; ++i) {
+        colors[i] = lerpColor(
+          c2[i],
+          blendColor(c1[i], c2[i], MULTIPLY),
+          (float) (2.*(1. - progress)),
+          RGB);
+      }
+    }
+  }
+}
+
+
 class BassPod extends SCPattern {
 
   private GraphicEQ eq = null;
@@ -720,6 +748,9 @@ class ColorFuckerEffect extends SCEffect {
   }
   
   public void doApply(int[] colors) {
+    if (!enabled) {
+      return;
+    }
     float bMod = bright.getValuef();
     float sMod = sat.getValuef();
     float hMod = hueShift.getValuef();