dx method
The velocity of the object in the simulation at the given time.
Implementation
@override
double dx(double time) {
if (startValue.isNaN) return 0.0;
if (startValue == endValue) return 0.0;
double normalizedTime = time / duration;
double normalizedVelocity =
startVelocity / (endValue - startValue) * duration;
double normalizedOutput = normalizedVelocity > 2
? velocityOfLinearAccelerationEaseInOutWithInitialVelocity(
normalizedTime, normalizedVelocity)
: velocityOfConstantAccelerationEaseInOutWithInitialVelocity(
normalizedTime, normalizedVelocity);
return normalizedOutput * (endValue - startValue) / duration;
}