alpha
value for the layout is displayed along with instantaneous and averaged tick time and the average frame rate of the layout. Changing the number of nodes re-starts the layout.cy
member which is its target y value, the gravity
function, which is called from the force.on("tick"...)
callback has behaviour to move the nodes toward their cy
position on each tick.gravity
function and uses basic geometry to reflect the incident velocity in the plane of the boundary. It does this by manipulating the d.px
and d.py
values of the nodes. It is possible, however, for nodes to penetrate the boundaries due to limitations in the temporal resolution of the layout.p.q.x/y == p.q.px/py
) then the node is moved back toward the boundary. After it is fully recovered, the velocity of the node will be naturally determined by the distance it was last moved by the recovery behaviour.d.x
and d.px
by the rendering process. This means that decisions in the code based on position may not reflect the rendered state properly. This is fixed by adding a getter to each data point that returns a rounded version of d.x/y
and d.px/y
: d.q.x/y
and d.q.px/y
. The quantised versions are used for the decision making in the boundary collisions and recovery behaviour.cy
positions by other, more massive nodes in adjacent layers, in order to overcome this, a frustration factor is applied to the isolated nodes which has the effect of increasing they're effective mass with each tick that they are outside they're designated band. The increase in mass factor per tick is the windup which defaults to 0.01. This is adjustable via an input in the metrics panel. Nodes with an anxiety greater than one are highlighted with a white stroke and as soon as they make it to they're layer they're anxiety is switched back to 1.Math.random()
. This is controlled, for side constraints, via the constraint input in the metrics panel. The value of the constraint is the probability that nodes escaped to the sides will be moved back toward the bounding box.alpha
value. This is set to 0.1 when the layout is started and is normally reduced by 1% each tick until it reaches 0.005, at which point the layout will stop updating. It is possible to manipulate the cooling rate so that it cools at x% by dividing the current alpha value by the standard factor of 0.99 and multiplying it by (1 - x%) at the end of the tick callback: force.alpha(a/0.99*(1 - x))
forked from cool-Blue's block: Layered gravity with weak side constraints, mass and wind-up
Updated missing url https://gitcdn.xyz/repo/cool-Blue/d3-lib/master/filters/shadow.js to https://cdn.jsdelivr.net/gh/repo/cool-blue/d3-lib/filters/shadow.js
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js
https://cdnjs.cloudflare.com/ajax/libs/tinycolor/1.1.2/tinycolor.min.js
https://gitcdn.xyz/repo/cool-Blue/d3-lib/master/filters/shadow.js