Struct ExponentialDecayCurve
Represents a motion curve where velocity decays exponentially over time. Commonly used to simulate fling or momentum-based motion with smooth slowdown.
public readonly struct ExponentialDecayCurve
- Inherited Members
Constructors
ExponentialDecayCurve(TimeSpan, NFloat, NFloat, NFloat, double)
Initializes an exponential decay motion curve.
public ExponentialDecayCurve(TimeSpan startTime, NFloat startPosition, NFloat initialVelocity, NFloat decayPerSecond, double velocityThreshold = 0.5)
Parameters
startTime
TimeSpanThe time when motion begins.
startPosition
NFloatThe initial position.
initialVelocity
NFloatThe initial velocity (can be negative).
decayPerSecond
NFloatThe decay multiplier per second. A value less than 1, closer to 0 = faster decay. Recommended value is Normal.
velocityThreshold
doubleThe velocity below which motion is considered stopped (defaults to 0.5).
Fields
DecayPerSecond
The decay factor per second. Lower values result in faster deceleration.
public readonly NFloat DecayPerSecond
Field Value
EndTime
The time at which the motion ends, determined by when velocity falls below a defined threshold.
public readonly TimeSpan EndTime
Field Value
Fast
A faster decay factor (~0.99 per millisecond). Use for snappier motion.
public static readonly NFloat Fast
Field Value
InitialVelocity
The initial velocity at the start of the curve.
public readonly NFloat InitialVelocity
Field Value
Normal
A typical decay factor (~0.998 per millisecond). Use for normal fling decay.
public static readonly NFloat Normal
Field Value
StartPosition
The starting position of the motion.
public readonly NFloat StartPosition
Field Value
StartTime
The time at which the motion begins.
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 a given time.
public NFloat this[TimeSpan time] { get; }
Parameters
time
TimeSpanThe time to evaluate.
Property Value
- NFloat
The interpolated position at the specified time.
Methods
VelocityAt(TimeSpan)
Evaluates the velocity of the motion at a given time.
public NFloat VelocityAt(TimeSpan time)
Parameters
time
TimeSpanThe time to evaluate.
Returns
- NFloat
The current velocity at the specified time.