Table of Contents

Struct ExponentialDecayCurve

Namespace
Xui.Core.Animation
Assembly
Core.dll

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 TimeSpan

The time when motion begins.

startPosition NFloat

The initial position.

initialVelocity NFloat

The initial velocity (can be negative).

decayPerSecond NFloat

The decay multiplier per second. A value less than 1, closer to 0 = faster decay. Recommended value is Normal.

velocityThreshold double

The 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

NFloat

EndTime

The time at which the motion ends, determined by when velocity falls below a defined threshold.

public readonly TimeSpan EndTime

Field Value

TimeSpan

Fast

A faster decay factor (~0.99 per millisecond). Use for snappier motion.

public static readonly NFloat Fast

Field Value

NFloat

InitialVelocity

The initial velocity at the start of the curve.

public readonly NFloat InitialVelocity

Field Value

NFloat

Normal

A typical decay factor (~0.998 per millisecond). Use for normal fling decay.

public static readonly NFloat Normal

Field Value

NFloat

StartPosition

The starting position of the motion.

public readonly NFloat StartPosition

Field Value

NFloat

StartTime

The time at which the motion begins.

public readonly TimeSpan StartTime

Field Value

TimeSpan

Properties

FinalPosition

Gets the final position of the motion at EndTime.

public NFloat FinalPosition { get; }

Property Value

NFloat

this[TimeSpan]

Evaluates the position of the motion at a given time.

public NFloat this[TimeSpan time] { get; }

Parameters

time TimeSpan

The 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 TimeSpan

The time to evaluate.

Returns

NFloat

The current velocity at the specified time.