[Helix] Fade edges of base pairs
[SugarCubes.git] / ShaheenGandhi.pde
index 0bfef321c8d9a7d059022867c2422a62c9302129..a4b5532d57055a1611943b31d68ff8c2b5292192 100644 (file)
@@ -159,14 +159,14 @@ class HelixPattern extends SCPattern {
   private final BasicParameter basePairsOn = new BasicParameter("BPON", 1);
 
   private static final float helixCoilPeriod = 100;
-  private static final float helixCoilRadius = 45;
-  private static final float helixCoilGirth = 20;
-  private static final float helixCoilRotationPeriod = 10000;
+  private static final float helixCoilRadius = 50;
+  private static final float helixCoilGirth = 30;
+  private static final float helixCoilRotationPeriod = 5000;
 
   private static final float spokePeriod = 40;
-  private static final float spokeGirth = 10;
+  private static final float spokeGirth = 20;
   private static final float spokePhase = 10;
-  private static final float spokeRadius = 35; // helixCoilRadius - helixCoilGirth*.5f;
+  private static final float spokeRadius = helixCoilRadius - helixCoilGirth*.5f;
   
   private static final float tMin = -200;
   private static final float tMax = 200;
@@ -222,7 +222,8 @@ class HelixPattern extends SCPattern {
     }
     Line spokeLine = basePairs[spokeIndex];
     PVector pointOnSpoke = spokeLine.projectPoint(pt);
-    float b = ((PVector.dist(pt, pointOnSpoke) < spokeGirth) && (PVector.dist(pointOnSpoke, spokeLine.getPoint()) < spokeRadius)) ? 100.f : 0.f;
+    float d = PVector.dist(pt, pointOnSpoke);
+    float b = (PVector.dist(pointOnSpoke, spokeLine.getPoint()) < spokeRadius) ? constrain(100*(1 - ((d-.5*spokeGirth)/(spokeGirth*.5))), 0, 100) : 0.f;
     return color(100, 80.f, b);
   }