x method
The position of the object in the simulation at the given time.
Implementation
@override
double x(double time) {
if (startValue.isNaN) return endValue;
if (startValue == endValue) return startValue;
final normalizedTime = time / duration;
final normalizedVelocity =
startVelocity / (endValue - startValue) * duration;
final normalizedOutput = normalizedVelocity > 2
? _linearAccelerationEaseInOutWithInitialVelocity(
normalizedTime,
normalizedVelocity,
)
: _constantAccelerationEaseInOutWithInitialVelocity(
normalizedTime,
normalizedVelocity,
);
return startValue + normalizedOutput * (endValue - startValue);
}