# Xui.Core.Animation

Assembly: **Xui.Core** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`readonly struct ConstantDecelerationCurve`](#api-d21c0237db748692)
- [`readonly struct CubicMotionCurve`](#api-5777181040edf2ec)
- [`class Easing`](#api-a4e5d3909748fe31)
- [`readonly struct Easing.CubicBezier`](#api-850aea6480e5a969)
- [`readonly struct Easing.PolynomialEasing`](#api-054d61fb0aac4dc5)
- [`class ElasticMotion`](#api-425dd511c85f2082)
- [`readonly struct ExponentialDecayCurve`](#api-15333deab5e89409)
- [`readonly struct QuadraticMotionCurve`](#api-ab51a5d9b9f38e99)
- [`readonly struct SpringMotionCurve`](#api-5707d809076c60ba)

<a id="api-d21c0237db748692"></a>

## `readonly struct ConstantDecelerationCurve`

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.

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.

```csharp
public readonly struct ConstantDecelerationCurve
{
    public readonly TimeSpan StartTime;
    public readonly TimeSpan EndTime;
    public readonly nfloat A;
    public readonly nfloat V0;
    public readonly nfloat P0;
    public ConstantDecelerationCurve(TimeSpan startTime, nfloat position, nfloat velocity, nfloat accelerationMagnitude);
    public nfloat DurationSeconds { get; }

    public nfloat this[TimeSpan time] {[DebuggerStepThrough]
        get; }

    public nfloat VelocityAt(TimeSpan time);
}
```

<a id="api-feb8c8091747f229"></a>

### [`ConstantDecelerationCurve.ConstantDecelerationCurve(TimeSpan startTime, NFloat position, NFloat velocity, NFloat accelerationMagnitude)`](#api-feb8c8091747f229)


```csharp
public ConstantDecelerationCurve(TimeSpan startTime, nfloat position, nfloat velocity, nfloat accelerationMagnitude);
```

Constructs a motion curve with constant deceleration.

- **`startTime`** — The time when motion begins.

- **`position`** — The initial position at `startTime`.

- **`velocity`** — The initial velocity in pixels per second.

- **`accelerationMagnitude`** — The magnitude of deceleration (must be positive).

**Throws** `Thrown if  is not positive.`: Thrown if `accelerationMagnitude` is not positive.

<a id="api-a8855ceb03d3536d"></a>

### [`NFloat ConstantDecelerationCurve.A`](#api-a8855ceb03d3536d)


```csharp
public readonly nfloat A;
```

The constant acceleration applied during motion, typically negative.

<a id="api-a8c67d3356e0e7a4"></a>

### [`NFloat ConstantDecelerationCurve.DurationSeconds`](#api-a8c67d3356e0e7a4)


```csharp
public nfloat DurationSeconds { get; }
```

The total duration of the motion in seconds.

<a id="api-1c7691478da804ec"></a>

### [`TimeSpan ConstantDecelerationCurve.EndTime`](#api-1c7691478da804ec)


```csharp
public readonly TimeSpan EndTime;
```

The time when the motion stops (velocity reaches zero).

<a id="api-5efc45191759e773"></a>

### [`NFloat ConstantDecelerationCurve.this[TimeSpan time]`](#api-5efc45191759e773)


```csharp
public nfloat this[TimeSpan time] {[DebuggerStepThrough]
    get; }
```

Evaluates the position at the specified time.

- **`time`** — The absolute time at which to evaluate the position.

**Returns:** The position in pixels.

<a id="api-c0815cb306d9b1ee"></a>

### [`NFloat ConstantDecelerationCurve.P0`](#api-c0815cb306d9b1ee)


```csharp
public readonly nfloat P0;
```

The initial position at [`Xui.Core.Animation.ConstantDecelerationCurve.StartTime`](../xui-core-animation/index.md#api-975db59dfe063fdb), in pixels.

<a id="api-975db59dfe063fdb"></a>

### [`TimeSpan ConstantDecelerationCurve.StartTime`](#api-975db59dfe063fdb)


```csharp
public readonly TimeSpan StartTime;
```

The time when the motion begins.

<a id="api-3f5675952f0aa508"></a>

### [`NFloat ConstantDecelerationCurve.V0`](#api-3f5675952f0aa508)


```csharp
public readonly nfloat V0;
```

The initial velocity at [`Xui.Core.Animation.ConstantDecelerationCurve.StartTime`](../xui-core-animation/index.md#api-975db59dfe063fdb), in pixels per second.

<a id="api-3e3aaea885c8a053"></a>

### [`NFloat ConstantDecelerationCurve.VelocityAt(TimeSpan time)`](#api-3e3aaea885c8a053)


```csharp
public nfloat VelocityAt(TimeSpan time);
```

Evaluates the velocity at the specified time.

- **`time`** — The absolute time at which to evaluate the velocity.

**Returns:** The velocity in pixels per second.


<a id="api-5777181040edf2ec"></a>

## `readonly struct CubicMotionCurve`

Represents a 1D cubic motion curve over time, interpolating both position and velocity. Time is expressed using `System.TimeSpan`, and calculations are performed in seconds.

This curve is defined by a cubic polynomial: `f(t) = A·t³ + B·t² + C·t + D`, where `t` is time in seconds since the global epoch. It supports generation from boundary conditions (position and velocity at both ends), as well as curve continuation with seamless velocity transitions.

```csharp
public readonly struct CubicMotionCurve
{
    public readonly TimeSpan StartTime;
    public readonly TimeSpan EndTime;
    public readonly nfloat A;
    public readonly nfloat B;
    public readonly nfloat C;
    public readonly nfloat D;
    public CubicMotionCurve(TimeSpan startTime, TimeSpan endTime, nfloat a, nfloat b, nfloat c, nfloat d);
    public nfloat FinalPosition { get; }
    public nfloat DurationSeconds { get; }

    public CubicMotionCurve ContinueWithBoundaryConditions(TimeSpan startTime, TimeSpan endTime, nfloat endPosition, nfloat endVelocity);
    public static CubicMotionCurve FromBoundaryConditions(TimeSpan startTime, nfloat startPosition, nfloat startVelocity, TimeSpan endTime, nfloat endPosition, nfloat endVelocity);
    public nfloat this[TimeSpan time] {[DebuggerStepThrough]
        get; }

    public nfloat VelocityAt(TimeSpan time);
}
```

<a id="api-2d14d0fc3f902df7"></a>

### [`CubicMotionCurve.CubicMotionCurve(TimeSpan startTime, TimeSpan endTime, NFloat a, NFloat b, NFloat c, NFloat d)`](#api-2d14d0fc3f902df7)


```csharp
public CubicMotionCurve(TimeSpan startTime, TimeSpan endTime, nfloat a, nfloat b, nfloat c, nfloat d);
```

Initializes a new cubic motion curve with the given polynomial coefficients and time range.

<a id="api-8a8f93ac42b124e3"></a>

### [`NFloat CubicMotionCurve.A`](#api-8a8f93ac42b124e3)


```csharp
public readonly nfloat A;
```

The cubic coefficient (multiplied by t&#179;).

<a id="api-27c67f38784d3641"></a>

### [`NFloat CubicMotionCurve.B`](#api-27c67f38784d3641)


```csharp
public readonly nfloat B;
```

The quadratic coefficient (multiplied by t&#178;).

<a id="api-d9fd6a2b0aee8d64"></a>

### [`NFloat CubicMotionCurve.C`](#api-d9fd6a2b0aee8d64)


```csharp
public readonly nfloat C;
```

The linear coefficient (multiplied by t).

<a id="api-7ef87cab5eb49322"></a>

### [`CubicMotionCurve CubicMotionCurve.ContinueWithBoundaryConditions(TimeSpan startTime, TimeSpan endTime, NFloat endPosition, NFloat endVelocity)`](#api-7ef87cab5eb49322)


```csharp
public CubicMotionCurve ContinueWithBoundaryConditions(TimeSpan startTime, TimeSpan endTime, nfloat endPosition, nfloat endVelocity);
```

Continues the current curve by constructing a new cubic motion curve that begins where this one leaves off, matching position and velocity, and interpolating to a new position and velocity over the given time range.

<a id="api-f0bae08ee607bfd5"></a>

### [`NFloat CubicMotionCurve.D`](#api-f0bae08ee607bfd5)


```csharp
public readonly nfloat D;
```

The constant offset term.

<a id="api-79f73522411e9c8b"></a>

### [`NFloat CubicMotionCurve.DurationSeconds`](#api-79f73522411e9c8b)


```csharp
public nfloat DurationSeconds { get; }
```

The duration of the motion curve, in seconds.

<a id="api-c237ecaa8b11d03f"></a>

### [`TimeSpan CubicMotionCurve.EndTime`](#api-c237ecaa8b11d03f)


```csharp
public readonly TimeSpan EndTime;
```

The time at which the motion curve ends.

<a id="api-6c280c245702257f"></a>

### [`NFloat CubicMotionCurve.FinalPosition`](#api-6c280c245702257f)


```csharp
public nfloat FinalPosition { get; }
```

The final position at [`Xui.Core.Animation.CubicMotionCurve.EndTime`](../xui-core-animation/index.md#api-c237ecaa8b11d03f).

<a id="api-4af27d7e09a49ee9"></a>

### [`CubicMotionCurve CubicMotionCurve.FromBoundaryConditions(TimeSpan startTime, NFloat startPosition, NFloat startVelocity, TimeSpan endTime, NFloat endPosition, NFloat endVelocity)`](#api-4af27d7e09a49ee9)


```csharp
public static CubicMotionCurve FromBoundaryConditions(TimeSpan startTime, nfloat startPosition, nfloat startVelocity, TimeSpan endTime, nfloat endPosition, nfloat endVelocity);
```

Constructs a cubic motion curve that interpolates position and velocity between two points in time using Hermite interpolation.

- **`startTime`** — The curve&#39;s start time.

- **`startPosition`** — The position at `startTime`.

- **`startVelocity`** — The velocity at `startTime`.

- **`endTime`** — The curve&#39;s end time.

- **`endPosition`** — The position at `endTime`.

- **`endVelocity`** — The velocity at `endTime`.

**Returns:** A cubic motion curve satisfying the specified boundary conditions.

<a id="api-e829037ccfdbaf14"></a>

### [`NFloat CubicMotionCurve.this[TimeSpan time]`](#api-e829037ccfdbaf14)


```csharp
public nfloat this[TimeSpan time] {[DebuggerStepThrough]
    get; }
```

Evaluates the position at the specified time.

- **`time`** — An absolute time value.

**Returns:** The position at the given time.

<a id="api-22ecc26f03050a5f"></a>

### [`TimeSpan CubicMotionCurve.StartTime`](#api-22ecc26f03050a5f)


```csharp
public readonly TimeSpan StartTime;
```

The time at which the motion curve starts.

<a id="api-62eec9aa8ffd9713"></a>

### [`NFloat CubicMotionCurve.VelocityAt(TimeSpan time)`](#api-62eec9aa8ffd9713)


```csharp
public nfloat VelocityAt(TimeSpan time);
```

Evaluates the velocity at the specified time.

- **`time`** — An absolute time value.

**Returns:** The velocity at the given time.


<a id="api-a4e5d3909748fe31"></a>

## `class Easing`

Provides a collection of easing functions and smoothing utilities used in animations. All easing methods are normalized to take a parameter `t` in the range [0, 1].

```csharp
public static partial class Easing
{
    public readonly struct CubicBezier
    {
        public readonly Point P1;
        public readonly Point P2;
        public CubicBezier(Point p1, Point p2);
        public Point Lerp(nfloat t);
        public nfloat Evaluate(nfloat x);
        public nfloat Evaluate(nfloat x, nfloat precision);
        public nfloat this[nfloat x] { get; }

        public nfloat ClosestT(Point target);
        public CubicBezier Drag(Point origin, Vector delta);
        public CubicBezier DragAt(nfloat t, Vector delta);
        public static implicit operator CubicBezier(Curves2D.CubicBezier bezier);
        public static CubicBezier Ease { get; }
        public static CubicBezier EaseIn { get; }
        public static CubicBezier EaseOut { get; }
        public static CubicBezier EaseInOut { get; }
    }
}
public static partial class Easing
{
    public readonly struct PolynomialEasing
    {
        public readonly nfloat A;
        public readonly nfloat B;
        public readonly nfloat C;
        public readonly nfloat D;
        public readonly nfloat E;
        public PolynomialEasing(nfloat b, nfloat c, nfloat d, nfloat e);
        public PolynomialEasing(nfloat a, nfloat b, nfloat c, nfloat d, nfloat e);
        public PolynomialEasing(CubicBezier bezier, int samples = 16);
        public nfloat this[nfloat x] {[DebuggerStepThrough]
            get; }
    }
}
public static partial class Easing
{
    public static nfloat Normalize(nfloat value, nfloat min, nfloat max);
    public static nfloat EaseInOutSine(nfloat t);
    public static nfloat EaseInQuad(nfloat t);
    public static nfloat EaseOutQuad(nfloat t);
    public static nfloat EaseInOutQuad(nfloat t);
    public static nfloat EaseInCubic(nfloat t);
    public static nfloat EaseOutCubic(nfloat t);
    public static nfloat EaseInOutCubic(nfloat t);
    public static nfloat EaseInQuart(nfloat t);
    public static nfloat EaseOutQuart(nfloat t);
    public static nfloat EaseInOutQuart(nfloat t);
    public static nfloat EaseInElastic(nfloat t);
    public static nfloat EaseOutElastic(nfloat t);
    public static nfloat EaseInOutElastic(nfloat t);
    public static nfloat EaseInBack(nfloat t);
    public static nfloat EaseOutBack(nfloat t);
    public static nfloat EaseInOutBack(nfloat t);
    public static nfloat EaseOutBounce(nfloat t);
    public static nfloat EaseInBounce(nfloat t);
    public static nfloat EaseInOutBounce(nfloat t);
    public static nfloat SmootherStep(nfloat t);
    public static nfloat SmoothDamp(nfloat from, nfloat to, ref nfloat velocity, nfloat smoothTime, nfloat maxSpeed, nfloat deltaTime);
}
```

<a id="api-520017b2c20eac45"></a>

### [`NFloat Easing.EaseInBack(NFloat t)`](#api-520017b2c20eac45)


```csharp
public static nfloat EaseInBack(nfloat t);
```

Eases in with a &quot;backwards&quot; overshoot effect before settling forward.

<a id="api-9ebb4acf192f6912"></a>

### [`NFloat Easing.EaseInBounce(NFloat t)`](#api-9ebb4acf192f6912)


```csharp
public static nfloat EaseInBounce(nfloat t);
```

Reverses EaseOutBounce to ease in with bounce.

<a id="api-e30903836bcb41cf"></a>

### [`NFloat Easing.EaseInCubic(NFloat t)`](#api-e30903836bcb41cf)


```csharp
public static nfloat EaseInCubic(nfloat t);
```

Accelerates slowly with a cubic curve.

<a id="api-75f42aece0fab78c"></a>

### [`NFloat Easing.EaseInElastic(NFloat t)`](#api-75f42aece0fab78c)


```csharp
public static nfloat EaseInElastic(nfloat t);
```

Creates an elastic &quot;bounce-in&quot; effect at the beginning of the transition.

<a id="api-6b0a4e4763053e63"></a>

### [`NFloat Easing.EaseInOutBack(NFloat t)`](#api-6b0a4e4763053e63)


```csharp
public static nfloat EaseInOutBack(nfloat t);
```

Eases in and out with a &quot;backwards&quot; overshoot at both ends.

<a id="api-14c6c2f1b93466d8"></a>

### [`NFloat Easing.EaseInOutBounce(NFloat t)`](#api-14c6c2f1b93466d8)


```csharp
public static nfloat EaseInOutBounce(nfloat t);
```

Eases in and out with a bounce at both ends.

<a id="api-9131372176915e1b"></a>

### [`NFloat Easing.EaseInOutCubic(NFloat t)`](#api-9131372176915e1b)


```csharp
public static nfloat EaseInOutCubic(nfloat t);
```

Smoothly accelerates and decelerates with a cubic curve.

<a id="api-a785b9ec9006536a"></a>

### [`NFloat Easing.EaseInOutElastic(NFloat t)`](#api-a785b9ec9006536a)


```csharp
public static nfloat EaseInOutElastic(nfloat t);
```

Combines EaseInElastic and EaseOutElastic for a spring-like bounce effect at both ends.

<a id="api-b6f02030ef87d523"></a>

### [`NFloat Easing.EaseInOutQuad(NFloat t)`](#api-b6f02030ef87d523)


```csharp
public static nfloat EaseInOutQuad(nfloat t);
```

Accelerates and decelerates using a quadratic curve.

<a id="api-d8204c8c10cd631e"></a>

### [`NFloat Easing.EaseInOutQuart(NFloat t)`](#api-d8204c8c10cd631e)


```csharp
public static nfloat EaseInOutQuart(nfloat t);
```

Strong acceleration and deceleration using a quartic curve.

<a id="api-7ed325c66f4ca16d"></a>

### [`NFloat Easing.EaseInOutSine(NFloat t)`](#api-7ed325c66f4ca16d)


```csharp
public static nfloat EaseInOutSine(nfloat t);
```

Eases in and out with a sine curve. Smoothest at beginning and end.

<a id="api-9c0808bc816fe6ac"></a>

### [`NFloat Easing.EaseInQuad(NFloat t)`](#api-9c0808bc816fe6ac)


```csharp
public static nfloat EaseInQuad(nfloat t);
```

Accelerates slowly from 0 to 1 with a quadratic curve.

<a id="api-c3e736696acb3197"></a>

### [`NFloat Easing.EaseInQuart(NFloat t)`](#api-c3e736696acb3197)


```csharp
public static nfloat EaseInQuart(nfloat t);
```

Stronger acceleration from 0 using a quartic curve.

<a id="api-d4f361059f6815be"></a>

### [`NFloat Easing.EaseOutBack(NFloat t)`](#api-d4f361059f6815be)


```csharp
public static nfloat EaseOutBack(nfloat t);
```

Eases out with a slight overshoot after reaching the target.

<a id="api-1b15e314874bdb18"></a>

### [`NFloat Easing.EaseOutBounce(NFloat t)`](#api-1b15e314874bdb18)


```csharp
public static nfloat EaseOutBounce(nfloat t);
```

Creates a bounce effect as if hitting the ground and bouncing back.

<a id="api-7356312f99eda926"></a>

### [`NFloat Easing.EaseOutCubic(NFloat t)`](#api-7356312f99eda926)


```csharp
public static nfloat EaseOutCubic(nfloat t);
```

Decelerates slowly with a cubic curve.

<a id="api-8d923debe5151ea9"></a>

### [`NFloat Easing.EaseOutElastic(NFloat t)`](#api-8d923debe5151ea9)


```csharp
public static nfloat EaseOutElastic(nfloat t);
```

Creates an elastic &quot;bounce-out&quot; effect at the end of the transition.

<a id="api-16ee898deff3596c"></a>

### [`NFloat Easing.EaseOutQuad(NFloat t)`](#api-16ee898deff3596c)


```csharp
public static nfloat EaseOutQuad(nfloat t);
```

Decelerates smoothly from 1 to 0 with a quadratic curve.

<a id="api-bffee04e6d3d6c05"></a>

### [`NFloat Easing.EaseOutQuart(NFloat t)`](#api-bffee04e6d3d6c05)


```csharp
public static nfloat EaseOutQuart(nfloat t);
```

Stronger deceleration to 1 using a quartic curve.

<a id="api-3824aeb8357175b7"></a>

### [`NFloat Easing.Normalize(NFloat value, NFloat min, NFloat max)`](#api-3824aeb8357175b7)


```csharp
public static nfloat Normalize(nfloat value, nfloat min, nfloat max);
```

Normalizes a value between `min` and `max` into a [0,1] range. Returns 0 if `max` ≤ `min`.

<a id="api-8e9dac8e5857f0fa"></a>

### [`NFloat Easing.SmoothDamp(NFloat from, NFloat to, ref NFloat velocity, NFloat smoothTime, NFloat maxSpeed, NFloat deltaTime)`](#api-8e9dac8e5857f0fa)


```csharp
public static nfloat SmoothDamp(nfloat from, nfloat to, ref nfloat velocity, nfloat smoothTime, nfloat maxSpeed, nfloat deltaTime);
```

Smoothly interpolates between two values using a critically damped spring-like function.

- **`from`** — The starting value.

- **`to`** — The target value.

- **`velocity`** — Reference to current velocity (will be modified).

- **`smoothTime`** — Time it takes to reach the target value.

- **`maxSpeed`** — Maximum speed during interpolation.

- **`deltaTime`** — Elapsed time since the last update.

<a id="api-62ca0325b05f23d8"></a>

### [`NFloat Easing.SmootherStep(NFloat t)`](#api-62ca0325b05f23d8)


```csharp
public static nfloat SmootherStep(nfloat t);
```

Applies a smoothstep-like easing function that produces smooth transitions with zero first and second derivatives at boundaries.


<a id="api-850aea6480e5a969"></a>

## `readonly struct Easing.CubicBezier`

Represents a CSS-style cubic B&#233;zier easing curve constrained between (0,0) and (1,1).

These curves are used for timing animations and transitions. The curve always starts at (0,0) and ends at (1,1), and the control points [`Xui.Core.Animation.Easing.CubicBezier.P1`](../xui-core-animation/index.md#api-49d752b4426cad7c) and [`Xui.Core.Animation.Easing.CubicBezier.P2`](../xui-core-animation/index.md#api-9ac4ee9f19ca55d1) shape the acceleration and deceleration of the animation.

```csharp
public readonly struct CubicBezier
{
    public readonly Point P1;
    public readonly Point P2;
    public CubicBezier(Point p1, Point p2);
    public Point Lerp(nfloat t);
    public nfloat Evaluate(nfloat x);
    public nfloat Evaluate(nfloat x, nfloat precision);
    public nfloat this[nfloat x] { get; }

    public nfloat ClosestT(Point target);
    public CubicBezier Drag(Point origin, Vector delta);
    public CubicBezier DragAt(nfloat t, Vector delta);
    public static implicit operator CubicBezier(Curves2D.CubicBezier bezier);
    public static CubicBezier Ease { get; }
    public static CubicBezier EaseIn { get; }
    public static CubicBezier EaseOut { get; }
    public static CubicBezier EaseInOut { get; }
}
```

<a id="api-86a610816df55b4b"></a>

### [`CubicBezier.CubicBezier(Point p1, Point p2)`](#api-86a610816df55b4b)


```csharp
public CubicBezier(Point p1, Point p2);
```

Initializes a new CSS-style cubic B&#233;zier easing curve with the given control points. Assumes endpoints at (0,0) and (1,1).

<a id="api-c8cadeb7feb9ddac"></a>

### [`NFloat CubicBezier.ClosestT(Point target)`](#api-c8cadeb7feb9ddac)


```csharp
public nfloat ClosestT(Point target);
```

Finds the parameter `t` ∈ [0, 1] where the curve is closest to the given `target` point. Uses 16-step approximation.

<a id="api-8af142eb41b07837"></a>

### [`CubicBezier CubicBezier.Drag(Point origin, Vector delta)`](#api-8af142eb41b07837)


```csharp
public CubicBezier Drag(Point origin, Vector delta);
```

Returns a new cubic B&#233;zier easing curve with a deformation applied near the closest point to `origin`, shifted by `delta`.

<a id="api-479dc560cd82194c"></a>

### [`CubicBezier CubicBezier.DragAt(NFloat t, Vector delta)`](#api-479dc560cd82194c)


```csharp
public CubicBezier DragAt(nfloat t, Vector delta);
```

Returns a new cubic B&#233;zier easing curve with a deformation applied at the given parameter `t` by `delta`.

<a id="api-d038ac6f6ef8eaa7"></a>

### [`CubicBezier CubicBezier.Ease`](#api-d038ac6f6ef8eaa7)


```csharp
public static CubicBezier Ease { get; }
```

Equivalent to CSS `ease`: cubic-bezier(0.25, 0.1, 0.25, 1.0)

<a id="api-68af79eda8017f04"></a>

### [`CubicBezier CubicBezier.EaseIn`](#api-68af79eda8017f04)


```csharp
public static CubicBezier EaseIn { get; }
```

Equivalent to CSS `ease-in`: cubic-bezier(0.42, 0, 1.0, 1.0)

<a id="api-8a0b3d68118950d6"></a>

### [`CubicBezier CubicBezier.EaseInOut`](#api-8a0b3d68118950d6)


```csharp
public static CubicBezier EaseInOut { get; }
```

Equivalent to CSS `ease-in-out`: cubic-bezier(0.42, 0, 0.58, 1.0)

<a id="api-d3ac4eeabef041fd"></a>

### [`CubicBezier CubicBezier.EaseOut`](#api-d3ac4eeabef041fd)


```csharp
public static CubicBezier EaseOut { get; }
```

Equivalent to CSS `ease-out`: cubic-bezier(0, 0, 0.58, 1.0)

<a id="api-ec9d34413d3a401e"></a>

### [`NFloat CubicBezier.Evaluate(NFloat x)`](#api-ec9d34413d3a401e)


```csharp
public nfloat Evaluate(nfloat x);
```

Approximates the Y output value for a given input X ∈ [0,1] using a 16-step lookup table.

<a id="api-ea243a0c6cbf084a"></a>

### [`NFloat CubicBezier.Evaluate(NFloat x, NFloat precision)`](#api-ea243a0c6cbf084a)


```csharp
public nfloat Evaluate(nfloat x, nfloat precision);
```

Approximates the Y output value for a given input X ∈ [0,1] using binary search to the given precision.

<a id="api-894cc7040e090963"></a>

### [`NFloat CubicBezier.this[NFloat x]`](#api-894cc7040e090963)


```csharp
public nfloat this[nfloat x] { get; }
```

Indexer alias for [`Xui.Core.Animation.Easing.CubicBezier.Evaluate(System.Runtime.InteropServices.NFloat)`](../xui-core-animation/index.md#api-ec9d34413d3a401e).

<a id="api-532deabf765e0706"></a>

### [`Point CubicBezier.Lerp(NFloat t)`](#api-532deabf765e0706)


```csharp
public Point Lerp(nfloat t);
```

Returns the interpolated point on the B&#233;zier curve at a given `t` ∈ [0, 1].

<a id="api-49d752b4426cad7c"></a>

### [`Point CubicBezier.P1`](#api-49d752b4426cad7c)


```csharp
public readonly Point P1;
```

The first control point (typically near the origin).

<a id="api-9ac4ee9f19ca55d1"></a>

### [`Point CubicBezier.P2`](#api-9ac4ee9f19ca55d1)


```csharp
public readonly Point P2;
```

The second control point (typically near the destination).

<a id="api-8e21d49ae3575142"></a>

### [`CubicBezier.implicit operator CubicBezier(CubicBezier bezier)`](#api-8e21d49ae3575142)


```csharp
public static implicit operator CubicBezier(Curves2D.CubicBezier bezier);
```

Converts a full [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1) into a CSS-style easing curve. The curve must begin at (0,0) and end at (1,1).


<a id="api-054d61fb0aac4dc5"></a>

## `readonly struct Easing.PolynomialEasing`

Represents a 3rd- or 4th-degree polynomial easing function for animation timing curves.

This type can be used to approximate B&#233;zier-based easing curves (like [`Xui.Core.Animation.Easing.CubicBezier`](../xui-core-animation/index.md#api-850aea6480e5a969)) using polynomial coefficients, which are faster to evaluate and easier to store or serialize.

```csharp
public readonly struct PolynomialEasing
{
    public readonly nfloat A;
    public readonly nfloat B;
    public readonly nfloat C;
    public readonly nfloat D;
    public readonly nfloat E;
    public PolynomialEasing(nfloat b, nfloat c, nfloat d, nfloat e);
    public PolynomialEasing(nfloat a, nfloat b, nfloat c, nfloat d, nfloat e);
    public PolynomialEasing(CubicBezier bezier, int samples = 16);
    public nfloat this[nfloat x] {[DebuggerStepThrough]
        get; }
}
```

<a id="api-efe1d4ae5ba8e2f6"></a>

### [`PolynomialEasing.PolynomialEasing(NFloat b, NFloat c, NFloat d, NFloat e)`](#api-efe1d4ae5ba8e2f6)


```csharp
public PolynomialEasing(nfloat b, nfloat c, nfloat d, nfloat e);
```

Constructs a 3rd-degree polynomial: y = B&#183;x&#179; + C&#183;x&#178; + D&#183;x + E

<a id="api-5f9c3ff42d4e941c"></a>

### [`PolynomialEasing.PolynomialEasing(NFloat a, NFloat b, NFloat c, NFloat d, NFloat e)`](#api-5f9c3ff42d4e941c)


```csharp
public PolynomialEasing(nfloat a, nfloat b, nfloat c, nfloat d, nfloat e);
```

Constructs a 4th-degree polynomial: y = A&#183;x⁴ + B&#183;x&#179; + C&#183;x&#178; + D&#183;x + E

<a id="api-d56f702afd92785c"></a>

### [`PolynomialEasing.PolynomialEasing(CubicBezier bezier, int samples = 16)`](#api-d56f702afd92785c)


```csharp
public PolynomialEasing(CubicBezier bezier, int samples = 16);
```

Approximates a [`Xui.Core.Animation.Easing.CubicBezier`](../xui-core-animation/index.md#api-850aea6480e5a969) easing curve using a cubic polynomial. The result fits y = B&#183;x&#179; + C&#183;x&#178; + D&#183;x + E over the domain x ∈ [0, 1].

- **`bezier`** — The B&#233;zier curve to approximate.

- **`samples`** — Number of sample points to use in least-squares fitting. Default is 16.

<a id="api-8d03f522c2ea4262"></a>

### [`NFloat PolynomialEasing.A`](#api-8d03f522c2ea4262)


```csharp
public readonly nfloat A;
```

The coefficient for x⁴ (A = 0 for cubic curves).

<a id="api-62fc6ca80f6ab89e"></a>

### [`NFloat PolynomialEasing.B`](#api-62fc6ca80f6ab89e)


```csharp
public readonly nfloat B;
```

The coefficient for x&#179;.

<a id="api-d4e0c160d76e1a7e"></a>

### [`NFloat PolynomialEasing.C`](#api-d4e0c160d76e1a7e)


```csharp
public readonly nfloat C;
```

The coefficient for x&#178;.

<a id="api-b996836c76f92566"></a>

### [`NFloat PolynomialEasing.D`](#api-b996836c76f92566)


```csharp
public readonly nfloat D;
```

The coefficient for x&#185;.

<a id="api-98da4bca22b30e13"></a>

### [`NFloat PolynomialEasing.E`](#api-98da4bca22b30e13)


```csharp
public readonly nfloat E;
```

The constant term.

<a id="api-e19b15469751a889"></a>

### [`NFloat PolynomialEasing.this[NFloat x]`](#api-e19b15469751a889)


```csharp
public nfloat this[nfloat x] {[DebuggerStepThrough]
    get; }
```

Evaluates the polynomial at a given value of x ∈ [0, 1].

- **`x`** — The input value (typically time).

**Returns:** The eased value at x.


<a id="api-425dd511c85f2082"></a>

## `class ElasticMotion`

Bounded rubber-band displacement for dragging beyond a scrollable range.

```csharp
public static class ElasticMotion
{
    public static nfloat Resist(nfloat position, nfloat min, nfloat max, nfloat viewport);
    public static nfloat Resist(nfloat position, nfloat min, nfloat max, nfloat viewport, nfloat resistance);
    public static nfloat Unresist(nfloat position, nfloat min, nfloat max, nfloat viewport);
    public static nfloat Unresist(nfloat position, nfloat min, nfloat max, nfloat viewport, nfloat resistance);
}
```

<a id="api-e35633bf8f5db13f"></a>

### [`NFloat ElasticMotion.Resist(NFloat position, NFloat min, NFloat max, NFloat viewport)`](#api-e35633bf8f5db13f)


```csharp
public static nfloat Resist(nfloat position, nfloat min, nfloat max, nfloat viewport);
```

Maps an unconstrained position to a progressively resisted position outside the bounds.

<a id="api-f0299b1816d06383"></a>

### [`NFloat ElasticMotion.Resist(NFloat position, NFloat min, NFloat max, NFloat viewport, NFloat resistance)`](#api-f0299b1816d06383)


```csharp
public static nfloat Resist(nfloat position, nfloat min, nfloat max, nfloat viewport, nfloat resistance);
```

Maps a position with a platform-specific resistance factor (smaller values feel firmer).

<a id="api-27e1e635ae854c94"></a>

### [`NFloat ElasticMotion.Unresist(NFloat position, NFloat min, NFloat max, NFloat viewport)`](#api-27e1e635ae854c94)


```csharp
public static nfloat Unresist(nfloat position, nfloat min, nfloat max, nfloat viewport);
```

Recovers the drag position so a new delta or a grabbed rebound does not jump.

<a id="api-d75c3899d30609ae"></a>

### [`NFloat ElasticMotion.Unresist(NFloat position, NFloat min, NFloat max, NFloat viewport, NFloat resistance)`](#api-d75c3899d30609ae)


```csharp
public static nfloat Unresist(nfloat position, nfloat min, nfloat max, nfloat viewport, nfloat resistance);
```

Inverts resistance using the same factor as the drag that produced the position.


<a id="api-15333deab5e89409"></a>

## `readonly struct ExponentialDecayCurve`

Represents a motion curve where velocity decays exponentially over time. Commonly used to simulate fling or momentum-based motion with smooth slowdown.

```csharp
public readonly struct ExponentialDecayCurve
{
    public readonly TimeSpan StartTime;
    public readonly TimeSpan EndTime;
    public readonly nfloat DecayPerSecond;
    public readonly nfloat InitialVelocity;
    public readonly nfloat StartPosition;
    public static readonly nfloat Normal;
    public static readonly nfloat Fast;
    [DebuggerStepThrough]
    public ExponentialDecayCurve(TimeSpan startTime, nfloat startPosition, nfloat initialVelocity, nfloat decayPerSecond, double velocityThreshold = 0.5);
    public nfloat FinalPosition { get; }

    public nfloat this[TimeSpan time] {[DebuggerStepThrough]
        get; }

    public nfloat VelocityAt(TimeSpan time);
}
```

<a id="api-88613a4d645bc319"></a>

### [`ExponentialDecayCurve.ExponentialDecayCurve(TimeSpan startTime, NFloat startPosition, NFloat initialVelocity, NFloat decayPerSecond, double velocityThreshold = 0.5)`](#api-88613a4d645bc319)


```csharp
[DebuggerStepThrough]
public ExponentialDecayCurve(TimeSpan startTime, nfloat startPosition, nfloat initialVelocity, nfloat decayPerSecond, double velocityThreshold = 0.5);
```

Initializes an exponential decay motion curve.

- **`startTime`** — The time when motion begins.

- **`startPosition`** — The initial position.

- **`initialVelocity`** — The initial velocity (can be negative).

- **`decayPerSecond`** — The decay multiplier per second. A value less than 1, closer to 0 = faster decay. Recommended value is [`Xui.Core.Animation.ExponentialDecayCurve.Normal`](../xui-core-animation/index.md#api-bc7f50aa8c2a1458).

- **`velocityThreshold`** — The velocity below which motion is considered stopped (defaults to 0.5).

<a id="api-5239fbd93f955fb3"></a>

### [`NFloat ExponentialDecayCurve.DecayPerSecond`](#api-5239fbd93f955fb3)


```csharp
public readonly nfloat DecayPerSecond;
```

The decay factor per second. Lower values result in faster deceleration.

<a id="api-0c703ead4ac8524b"></a>

### [`TimeSpan ExponentialDecayCurve.EndTime`](#api-0c703ead4ac8524b)


```csharp
public readonly TimeSpan EndTime;
```

The time at which the motion ends, determined by when velocity falls below a defined threshold.

<a id="api-f354f190c18380d9"></a>

### [`NFloat ExponentialDecayCurve.Fast`](#api-f354f190c18380d9)


```csharp
public static readonly nfloat Fast;
```

A faster decay factor (~0.99 per millisecond). Use for snappier motion.

<a id="api-490fcaf3301b656d"></a>

### [`NFloat ExponentialDecayCurve.FinalPosition`](#api-490fcaf3301b656d)


```csharp
public nfloat FinalPosition { get; }
```

Gets the final position of the motion at [`Xui.Core.Animation.ExponentialDecayCurve.EndTime`](../xui-core-animation/index.md#api-0c703ead4ac8524b).

<a id="api-fcc330662421f6e5"></a>

### [`NFloat ExponentialDecayCurve.InitialVelocity`](#api-fcc330662421f6e5)


```csharp
public readonly nfloat InitialVelocity;
```

The initial velocity at the start of the curve.

<a id="api-d782dbee76952e4b"></a>

### [`NFloat ExponentialDecayCurve.this[TimeSpan time]`](#api-d782dbee76952e4b)


```csharp
public nfloat this[TimeSpan time] {[DebuggerStepThrough]
    get; }
```

Evaluates the position of the motion at a given time.

- **`time`** — The time to evaluate.

**Returns:** The interpolated position at the specified time.

<a id="api-bc7f50aa8c2a1458"></a>

### [`NFloat ExponentialDecayCurve.Normal`](#api-bc7f50aa8c2a1458)


```csharp
public static readonly nfloat Normal;
```

A typical decay factor (~0.998 per millisecond). Use for normal fling decay.

<a id="api-a17cc40fa476c445"></a>

### [`NFloat ExponentialDecayCurve.StartPosition`](#api-a17cc40fa476c445)


```csharp
public readonly nfloat StartPosition;
```

The starting position of the motion.

<a id="api-da16006c40d2ca3f"></a>

### [`TimeSpan ExponentialDecayCurve.StartTime`](#api-da16006c40d2ca3f)


```csharp
public readonly TimeSpan StartTime;
```

The time at which the motion begins.

<a id="api-9a20224dec6b0729"></a>

### [`NFloat ExponentialDecayCurve.VelocityAt(TimeSpan time)`](#api-9a20224dec6b0729)


```csharp
public nfloat VelocityAt(TimeSpan time);
```

Evaluates the velocity of the motion at a given time.

- **`time`** — The time to evaluate.

**Returns:** The current velocity at the specified time.


<a id="api-ab51a5d9b9f38e99"></a>

## `readonly 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.

```csharp
public readonly struct QuadraticMotionCurve
{
    public readonly TimeSpan StartTime;
    public readonly TimeSpan EndTime;
    public readonly nfloat A;
    public readonly nfloat B;
    public readonly nfloat C;
    [DebuggerStepThrough]
    public QuadraticMotionCurve(TimeSpan startTime, TimeSpan endTime, nfloat a, nfloat b, nfloat c);
    public QuadraticMotionCurve(TimeSpan startTime, nfloat startPosition, nfloat startVelocity, nfloat accelerationMagnitude);
    public nfloat FinalPosition { get; }

    public nfloat this[TimeSpan time] {[DebuggerStepThrough]
        get; }

    public nfloat VelocityAt(TimeSpan time);
}
```

<a id="api-7b1d04e5d996b5ec"></a>

### [`QuadraticMotionCurve.QuadraticMotionCurve(TimeSpan startTime, NFloat startPosition, NFloat startVelocity, NFloat accelerationMagnitude)`](#api-7b1d04e5d996b5ec)


```csharp
public QuadraticMotionCurve(TimeSpan startTime, nfloat startPosition, nfloat startVelocity, nfloat accelerationMagnitude);
```

Constructs a curve from initial position, velocity, and acceleration magnitude. The acceleration is applied in the opposite direction of velocity to decelerate to zero.

- **`startTime`** — The time when motion starts.

- **`startPosition`** — Initial position.

- **`startVelocity`** — Initial velocity (positive or negative).

- **`accelerationMagnitude`** — Positive scalar magnitude of deceleration.

<a id="api-16281f452a746379"></a>

### [`QuadraticMotionCurve.QuadraticMotionCurve(TimeSpan startTime, TimeSpan endTime, NFloat a, NFloat b, NFloat c)`](#api-16281f452a746379)


```csharp
[DebuggerStepThrough]
public QuadraticMotionCurve(TimeSpan startTime, TimeSpan endTime, nfloat a, nfloat b, nfloat c);
```

Initializes the curve with explicit polynomial coefficients and time range.

- **`startTime`** — The time when motion starts.

- **`endTime`** — The time when motion ends.

- **`a`** — The quadratic coefficient.

- **`b`** — The linear coefficient.

- **`c`** — The constant offset.

<a id="api-ddeb6ade73026b38"></a>

### [`NFloat QuadraticMotionCurve.A`](#api-ddeb6ade73026b38)


```csharp
public readonly nfloat A;
```

The quadratic coefficient (0.5 * acceleration).

<a id="api-3a621fca4b8b8331"></a>

### [`NFloat QuadraticMotionCurve.B`](#api-3a621fca4b8b8331)


```csharp
public readonly nfloat B;
```

The linear coefficient (initial velocity minus adjustment).

<a id="api-e0d10764effb6f09"></a>

### [`NFloat QuadraticMotionCurve.C`](#api-e0d10764effb6f09)


```csharp
public readonly nfloat C;
```

The constant coefficient (initial position minus offset).

<a id="api-130c8a5e19cf1c10"></a>

### [`TimeSpan QuadraticMotionCurve.EndTime`](#api-130c8a5e19cf1c10)


```csharp
public readonly TimeSpan EndTime;
```

The time at which the motion ends (i.e., when velocity reaches zero).

<a id="api-69fe359d5915b0fa"></a>

### [`NFloat QuadraticMotionCurve.FinalPosition`](#api-69fe359d5915b0fa)


```csharp
public nfloat FinalPosition { get; }
```

Gets the final position of the motion at [`Xui.Core.Animation.QuadraticMotionCurve.EndTime`](../xui-core-animation/index.md#api-130c8a5e19cf1c10).

<a id="api-3b339a2482f3cc5e"></a>

### [`NFloat QuadraticMotionCurve.this[TimeSpan time]`](#api-3b339a2482f3cc5e)


```csharp
public nfloat this[TimeSpan time] {[DebuggerStepThrough]
    get; }
```

Evaluates the position of the motion at the specified `time`.

- **`time`** — The time at which to evaluate the position.

<a id="api-544d667a77917340"></a>

### [`TimeSpan QuadraticMotionCurve.StartTime`](#api-544d667a77917340)


```csharp
public readonly TimeSpan StartTime;
```

The time at which the motion starts.

<a id="api-c69a0fb984a130c6"></a>

### [`NFloat QuadraticMotionCurve.VelocityAt(TimeSpan time)`](#api-c69a0fb984a130c6)


```csharp
public nfloat VelocityAt(TimeSpan time);
```

Evaluates the instantaneous velocity at the specified `time`.

- **`time`** — The time at which to evaluate the velocity.

**Returns:** The velocity in units per second.


<a id="api-5707d809076c60ba"></a>

## `readonly struct SpringMotionCurve`

A critically damped spring evaluated analytically, independent of display refresh rate.

```csharp
public readonly struct SpringMotionCurve
{
    public TimeSpan StartTime { get; }
    public nfloat Target { get; }

    public SpringMotionCurve(TimeSpan startTime, nfloat position, nfloat velocity, nfloat target);
    public nfloat this[TimeSpan time] { get; }

    public nfloat VelocityAt(TimeSpan time);
    public bool IsComplete(TimeSpan time);
}
```

<a id="api-e4596a9c789e8981"></a>

### [`SpringMotionCurve.SpringMotionCurve(TimeSpan startTime, NFloat position, NFloat velocity, NFloat target)`](#api-e4596a9c789e8981)


```csharp
public SpringMotionCurve(TimeSpan startTime, nfloat position, nfloat velocity, nfloat target);
```

Creates a spring preserving initial position and velocity.

<a id="api-4599061232162e59"></a>

### [`bool SpringMotionCurve.IsComplete(TimeSpan time)`](#api-4599061232162e59)


```csharp
public bool IsComplete(TimeSpan time);
```

Whether the curve is close enough to finish at its exact target.

<a id="api-e2aca72126917a97"></a>

### [`NFloat SpringMotionCurve.this[TimeSpan time]`](#api-e2aca72126917a97)


```csharp
public nfloat this[TimeSpan time] { get; }
```

Evaluates the position at an absolute frame time.

<a id="api-540f3b70677f1683"></a>

### [`TimeSpan SpringMotionCurve.StartTime`](#api-540f3b70677f1683)


```csharp
public TimeSpan StartTime { get; }
```

The time at which the rebound starts.

<a id="api-15579d36193321bf"></a>

### [`NFloat SpringMotionCurve.Target`](#api-15579d36193321bf)


```csharp
public nfloat Target { get; }
```

The exact resting position.

<a id="api-8aa1277d4f062758"></a>

### [`NFloat SpringMotionCurve.VelocityAt(TimeSpan time)`](#api-8aa1277d4f062758)


```csharp
public nfloat VelocityAt(TimeSpan time);
```

Evaluates the velocity in units per second.

