From dd6b1c27d09b5a7c73bba56f423c4dad1a0a5c27 Mon Sep 17 00:00:00 2001 From: Shaheen Gandhi Date: Tue, 20 Aug 2013 23:28:07 -0700 Subject: [PATCH] [Helix] Fade edges of base pairs --- ShaheenGandhi.pde | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShaheenGandhi.pde b/ShaheenGandhi.pde index f94e5e4..a4b5532 100644 --- a/ShaheenGandhi.pde +++ b/ShaheenGandhi.pde @@ -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); } -- 2.34.1