A module for forceSimulations to define connections between nodes as directional vectors, consisting of angles within a cone of dispersion, and magnitudes defined either by a constant or by a function of the individual vector
s. Reverse-engineered from the Link
force by Mike Bostock.
Public methods on vector
are all defined on the force
object at the bottom of vector.js
.
force.initialize
: begins running the simulationforce.nodes
: the data used for each nodeforce.vectors
: the connections between nodes, defined as an array ofsource
andtarget
objectsforce.id
: a function to allow the simulation to internally identify eachnode
for updatesforce.iterations
: (ADVANCED) I'm not really sure... it's just kind of a thing that Mike made work and it affects how strongly your force is applied during the simulationforce.orientation
: the basis degree for orienting the angles offorce.cone
force.direction
: 'reverse' will invert the cone of dispersionforce.strength
: a relative multiplier that affects the potency of each vector while the simulation is runningforce.magnitude
: either a constant number indicating the length in pixels of each vector, or a function applied to eachvector
to determine its relative lengthforce.cone
: an interpolative scale that is applied to a rawdegree
value to coerce the vector to go in a specific angle relative to its source