SpringSimulation constructor
Creates a spring simulation from the provided spring description, start distance, end distance, and initial velocity.
The units for the start and end distance arguments are arbitrary, but must be consistent with the units used for other lengths in the system.
The units for the velocity are L/T, where L is the aforementioned arbitrary unit of length, and T is the time unit used for driving the SpringSimulation.
If snapToEnd
is true, x will be set to end
and dx to 0 when
isDone returns true. This is useful for transitions that require the
simulation to stop exactly at the end value, since the spring may not
naturally reach the target precisely. Defaults to false.
Implementation
SpringSimulation(
SpringDescription spring,
double start,
double end,
double velocity, {
bool snapToEnd = false,
super.tolerance,
}) : _endPosition = end,
_solution = _SpringSolution(spring, start - end, velocity),
_snapToEnd = snapToEnd;