Struct QuadraticMotionCurve
Represents a 1D motion curve under constant acceleration, defined as a quadratic function of time.
This curve is useful for modeling motion that decelerates smoothly to a stop, such as fling or scroll-stop animations.
public readonly struct QuadraticMotionCurve
- Inherited Members
Constructors
QuadraticMotionCurve(TimeSpan, NFloat, NFloat, NFloat)
Constructs a curve from initial position, velocity, and acceleration magnitude. The acceleration is applied in the opposite direction of velocity to decelerate to zero.
public QuadraticMotionCurve(TimeSpan startTime, NFloat startPosition, NFloat startVelocity, NFloat accelerationMagnitude)
Parameters
startTimeTimeSpanThe time when motion starts.
startPositionNFloatInitial position.
startVelocityNFloatInitial velocity (positive or negative).
accelerationMagnitudeNFloatPositive scalar magnitude of deceleration.
QuadraticMotionCurve(TimeSpan, TimeSpan, NFloat, NFloat, NFloat)
Initializes the curve with explicit polynomial coefficients and time range.
public QuadraticMotionCurve(TimeSpan startTime, TimeSpan endTime, NFloat a, NFloat b, NFloat c)
Parameters
startTimeTimeSpanThe time when motion starts.
endTimeTimeSpanThe time when motion ends.
aNFloatThe quadratic coefficient.
bNFloatThe linear coefficient.
cNFloatThe constant offset.
Fields
A
The quadratic coefficient (0.5 * acceleration).
public readonly NFloat A
Field Value
B
The linear coefficient (initial velocity minus adjustment).
public readonly NFloat B
Field Value
C
The constant coefficient (initial position minus offset).
public readonly NFloat C
Field Value
EndTime
The time at which the motion ends (i.e., when velocity reaches zero).
public readonly TimeSpan EndTime
Field Value
StartTime
The time at which the motion starts.
public readonly TimeSpan StartTime
Field Value
Properties
FinalPosition
Gets the final position of the motion at EndTime.
public NFloat FinalPosition { get; }
Property Value
this[TimeSpan]
Evaluates the position of the motion at the specified time.
public NFloat this[TimeSpan time] { get; }
Parameters
timeTimeSpanThe time at which to evaluate the position.
Property Value
Methods
VelocityAt(TimeSpan)
Evaluates the instantaneous velocity at the specified time.
public NFloat VelocityAt(TimeSpan time)
Parameters
timeTimeSpanThe time at which to evaluate the velocity.
Returns
- NFloat
The velocity in units per second.