What is the difference between alphaTarget and alphaMin?

admin

Administrator
Staff member
The description from the API is confusing. I expect
Code:
target
to be the value where the simulation stops ticking, but what
Code:
target
does is not defined in the API. Also
Code:
alpha
itself is not defined in the API but I found that on another website:
<a href="https://roshansanthosh.wordpress.com/2016/09/25/forces-in-d3-js-v4/" rel="noreferrer">https://roshansanthosh.wordpress.com/2016/09/25/forces-in-d3-js-v4/</a>

<blockquote>
An important aspect of simulations is alpha. alpha is a number between 0 and 1 and defines how far the simulation has progressed. When a simulation starts alpha is set to 1 and this value slowly decays, based on the alphaDecay rate, until it reaches the alphaTarget of the simulation. Once the alpha value is less than the alphaTarget, the simulation comes to a halt. The alphaTarget by default is set to 0.1
</blockquote>

Now for the official API:

<h1><a href="https://github.com/d3/d3-force/blob/master/README.md#simulation_alphaMin" rel="noreferrer">simulation.alphaMin([min])</a></h1>

<blockquote>
If min is specified, sets the minimum alpha to the specified number in the range [0,1] and returns this simulation. If min is not specified, returns the current minimum alpha value, which defaults to 0.001. The simulation’s internal timer stops when the current alpha is less than the minimum alpha. The default alpha decay rate of ~0.0228 corresponds to 300 iterations.
</blockquote>

<h1><a href="https://github.com/d3/d3-force/blob/master/README.md#simulation_alphaTarget" rel="noreferrer">simulation.alphaTarget([target])</a></h1>

<blockquote>
If target is specified, sets the current target alpha to the specified number in the range [0,1] and returns this simulation. If target is not specified, returns the current target alpha value, which defaults to 0.
</blockquote>