diff --git a/src/link.js b/src/link.js index 5773c82..cd979f2 100644 --- a/src/link.js +++ b/src/link.js @@ -15,6 +15,7 @@ export default function() { nodes, stableVelocity = 0, stableVeloHandler = null, + latestVelocityDiff = 0 iterations = 1; function force(alpha) { @@ -54,6 +55,7 @@ export default function() { velocityDiff += Math.abs(Math.hypot(node.vx-node.oldvx, node.vy-node.oldvy)); } velocityDiff /= n*(n-1); + latestVelocityDiff = velocityDiff; if(velocityDiff