velEase function
Implementation
double velEase(
double startValue,
double endValue,
double startTime,
double endTime,
double currentTime,
double initialVelocity,
) {
if (startTime == double.negativeInfinity) {
return 0.0;
}
if (startValue == endValue) {
return 0.0;
}
double normalizedTime = (currentTime - startTime) / (endTime - startTime);
double normalizedVelocity =
initialVelocity / (endValue - startValue) * (endTime - startTime);
double normalizedOutput = normalizedVelocity > 2
? velocityOfLinearAccelerationEaseInOutWithInitialVelocity(
normalizedTime, normalizedVelocity)
: velocityOfConstantAccelerationEaseInOutWithInitialVelocity(
normalizedTime, normalizedVelocity);
return normalizedOutput * (endValue - startValue) / (endTime - startTime);
}