Table of Contents

Struct ConstantDecelerationCurve

Namespace
Xui.Core.Animation
Assembly
Core.dll

Represents a 1D motion curve with constant deceleration (e.g., for scroll or fling). Starts at a given position and velocity, then decelerates linearly to a stop.

public readonly struct ConstantDecelerationCurve
Inherited Members

Remarks

This model is commonly used in UI frameworks to simulate natural-feeling scroll behavior. The acceleration is constant and opposite to the direction of motion, resulting in a predictable, smooth slowdown.

Constructors

ConstantDecelerationCurve(TimeSpan, NFloat, NFloat, NFloat)

Constructs a motion curve with constant deceleration.

public ConstantDecelerationCurve(TimeSpan startTime, NFloat position, NFloat velocity, NFloat accelerationMagnitude)

Parameters

startTime TimeSpan

The time when motion begins.

position NFloat

The initial position at startTime.

velocity NFloat

The initial velocity in pixels per second.

accelerationMagnitude NFloat

The magnitude of deceleration (must be positive).

Exceptions

ArgumentOutOfRangeException

Thrown if accelerationMagnitude is not positive.

Fields

A

The constant acceleration applied during motion, typically negative.

public readonly NFloat A

Field Value

NFloat

EndTime

The time when the motion stops (velocity reaches zero).

public readonly TimeSpan EndTime

Field Value

TimeSpan

P0

The initial position at StartTime, in pixels.

public readonly NFloat P0

Field Value

NFloat

StartTime

The time when the motion begins.

public readonly TimeSpan StartTime

Field Value

TimeSpan

V0

The initial velocity at StartTime, in pixels per second.

public readonly NFloat V0

Field Value

NFloat

Properties

DurationSeconds

The total duration of the motion in seconds.

public NFloat DurationSeconds { get; }

Property Value

NFloat

this[TimeSpan]

Evaluates the position at the specified time.

public NFloat this[TimeSpan time] { get; }

Parameters

time TimeSpan

The absolute time at which to evaluate the position.

Property Value

NFloat

The position in pixels.

Methods

VelocityAt(TimeSpan)

Evaluates the velocity at the specified time.

public NFloat VelocityAt(TimeSpan time)

Parameters

time TimeSpan

The absolute time at which to evaluate the velocity.

Returns

NFloat

The velocity in pixels per second.