target property
double
get
target
Implementation
double get target => _target;
set
target
(double target)
Set a new target. The spring picks up from its current value and velocity. If the direction flips, velocity is negated (preserving momentum).
Implementation
set target(double target) {
if (_target != target) {
final wasGoingPositively = _target > _startValue;
final willBeGoingPositively = target > value;
if (wasGoingPositively != willBeGoingPositively) {
_velocity = -_velocity;
}
_startValue = value;
_target = target;
_delta = _target - _startValue;
if (_startValue != _target) {
_curT = 0.0;
_isDone = false;
_accelerationMultiplier = 0.0;
}
}
}