From e368d09f684840080b040f214886d3e133351620 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Fri, 11 Aug 2017 00:45:47 -0400 Subject: [PATCH] Make effect radii smaller on smaller screens --- js/proximity.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/proximity.js b/js/proximity.js index 20a0f56..3d65e3c 100644 --- a/js/proximity.js +++ b/js/proximity.js @@ -79,7 +79,7 @@ var clickPullRateStart = 0.01; // initial value for the ratio of a point's dista var clickPullRateInc = 0.005; // amount to increase clickPullRate every tick that a click is held var clickPullRateMax = 0.5; // maximum value of clickPullRate var clickPullRate = clickPullRateStart; -var clickMaxDistStart = 50; // initial value for the effect radius of a click: points this distance from click position will be pulled +var clickMaxDistStart = 50; // initial value for the effect radius of a click: points this distance from click position will be pulled (overridden if small screen size) var clickMaxDistInc = 2; // amount to increase clickMaxDist every tick that a click is held var clickMaxDistMax = 5000; // maximum value of clickMaxDist var clickMaxDist = clickMaxDistStart; @@ -94,7 +94,7 @@ var clickTweeningFnEnd = 12; // value of clickTweeningFn during tick after end o // hover effect related config vars var hoverPushRate = -0.05; // ratio of a point's distance from the hover position to travel in one cycle var hoverInertia = 0.8; // ratio of a point's origin distance from the click position to be added to point's new target -var hoverMaxDistStart = 75; // initial value for the effect radius of a hover: points this distance from hover position will be pushed +var hoverMaxDistStart = 75; // initial value for the effect radius of a hover: points this distance from hover position will be pushed (overridden if small screen size) var hoverMaxDistMax = 1000; // maximum value of hoverMaxDist var hoverMaxDist = hoverMaxDistStart; var hoverTweeningFn = 5; // specific tweening function to assign to points in effect radius @@ -671,6 +671,8 @@ function loopStart () { totalScreenPixels = screenWidth + screenHeight; connectionDistance = Math.min(Math.round(totalScreenPixels / 16), 75); pointShiftDistance = Math.round(totalScreenPixels / 45); + clickMaxDistStart = Math.min(Math.round(totalScreenPixels / 20), clickMaxDistStart); + hoverMaxDistStart = Math.min(Math.round(totalScreenPixels / 16), hoverMaxDistMax); polygon = new window.PIXI.Graphics(); stage.addChild(polygon); startPoints = getRandomPoints(Math.round(totalScreenPixels / 6), screenWidth, screenHeight, zRange, tweeningFns);