From df47f803e39dc214e09cfba4ed23a9570160aff3 Mon Sep 17 00:00:00 2001 From: gidsi Date: Wed, 28 Nov 2018 21:55:55 +0100 Subject: [PATCH] Revert "This reverts commit d40664595eb9bcf4503009fcf9de2322b5582a0d." This reverts commit 418de899e95f8a0add7bee61390399e32db75ee5. --- js/eyecandy.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/js/eyecandy.js b/js/eyecandy.js index 2ea11bf..9c61f90 100644 --- a/js/eyecandy.js +++ b/js/eyecandy.js @@ -114,19 +114,35 @@ // animation function initAnimation() { animate(); + for(var i in points) { + shiftPoint(points[i]); + } } function animate() { if(animateHeader) { ctx.clearRect(0,0,width,height); for(var i in points) { - points[i].active = 0.3; - points[i].circle.active = 0.6; + // detect points in range + if(Math.abs(getDistance(target, points[i])) < 4000) { + points[i].active = 0.3; + points[i].circle.active = 0.6; + } else if(Math.abs(getDistance(target, points[i])) < 20000) { + points[i].active = 0.1; + points[i].circle.active = 0.3; + } else if(Math.abs(getDistance(target, points[i])) < 40000) { + points[i].active = 0.02; + points[i].circle.active = 0.1; + } else { + points[i].active = 0; + points[i].circle.active = 0; + } drawLines(points[i]); points[i].circle.draw(); } } + requestAnimationFrame(animate); } function shiftPoint(p) {