Xui.Core.Animation

Assembly: Xui.Core · C# declarations · Assembly overview

Types

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.

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);
}

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

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.

NFloat ConstantDecelerationCurve.A

public readonly nfloat A;

The constant acceleration applied during motion, typically negative.

NFloat ConstantDecelerationCurve.DurationSeconds

public nfloat DurationSeconds { get; }

The total duration of the motion in seconds.

TimeSpan ConstantDecelerationCurve.EndTime

public readonly TimeSpan EndTime;

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

NFloat ConstantDecelerationCurve.this[TimeSpan time]

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.

NFloat ConstantDecelerationCurve.P0

public readonly nfloat P0;

The initial position at Xui.Core.Animation.ConstantDecelerationCurve.StartTime, in pixels.

TimeSpan ConstantDecelerationCurve.StartTime

public readonly TimeSpan StartTime;

The time when the motion begins.

NFloat ConstantDecelerationCurve.V0

public readonly nfloat V0;

The initial velocity at Xui.Core.Animation.ConstantDecelerationCurve.StartTime, in pixels per second.

NFloat ConstantDecelerationCurve.VelocityAt(TimeSpan time)

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.

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.

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);
}

CubicMotionCurve.CubicMotionCurve(TimeSpan startTime, TimeSpan endTime, NFloat a, NFloat b, NFloat c, NFloat d)

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.

NFloat CubicMotionCurve.A

public readonly nfloat A;

The cubic coefficient (multiplied by t³).

NFloat CubicMotionCurve.B

public readonly nfloat B;

The quadratic coefficient (multiplied by t²).

NFloat CubicMotionCurve.C

public readonly nfloat C;

The linear coefficient (multiplied by t).

CubicMotionCurve CubicMotionCurve.ContinueWithBoundaryConditions(TimeSpan startTime, TimeSpan endTime, NFloat endPosition, NFloat endVelocity)

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.

NFloat CubicMotionCurve.D

public readonly nfloat D;

The constant offset term.

NFloat CubicMotionCurve.DurationSeconds

public nfloat DurationSeconds { get; }

The duration of the motion curve, in seconds.

TimeSpan CubicMotionCurve.EndTime

public readonly TimeSpan EndTime;

The time at which the motion curve ends.

NFloat CubicMotionCurve.FinalPosition

public nfloat FinalPosition { get; }

The final position at Xui.Core.Animation.CubicMotionCurve.EndTime.

CubicMotionCurve CubicMotionCurve.FromBoundaryConditions(TimeSpan startTime, NFloat startPosition, NFloat startVelocity, TimeSpan endTime, NFloat endPosition, NFloat endVelocity)

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's start time.

  • startPosition — The position at startTime.

  • startVelocity — The velocity at startTime.

  • endTime — The curve's end time.

  • endPosition — The position at endTime.

  • endVelocity — The velocity at endTime.

Returns: A cubic motion curve satisfying the specified boundary conditions.

NFloat CubicMotionCurve.this[TimeSpan time]

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.

TimeSpan CubicMotionCurve.StartTime

public readonly TimeSpan StartTime;

The time at which the motion curve starts.

NFloat CubicMotionCurve.VelocityAt(TimeSpan time)

public nfloat VelocityAt(TimeSpan time);

Evaluates the velocity at the specified time.

  • time — An absolute time value.

Returns: The velocity at the given time.

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].

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);
}

NFloat Easing.EaseInBack(NFloat t)

public static nfloat EaseInBack(nfloat t);

Eases in with a "backwards" overshoot effect before settling forward.

NFloat Easing.EaseInBounce(NFloat t)

public static nfloat EaseInBounce(nfloat t);

Reverses EaseOutBounce to ease in with bounce.

NFloat Easing.EaseInCubic(NFloat t)

public static nfloat EaseInCubic(nfloat t);

Accelerates slowly with a cubic curve.

NFloat Easing.EaseInElastic(NFloat t)

public static nfloat EaseInElastic(nfloat t);

Creates an elastic "bounce-in" effect at the beginning of the transition.

NFloat Easing.EaseInOutBack(NFloat t)

public static nfloat EaseInOutBack(nfloat t);

Eases in and out with a "backwards" overshoot at both ends.

NFloat Easing.EaseInOutBounce(NFloat t)

public static nfloat EaseInOutBounce(nfloat t);

Eases in and out with a bounce at both ends.

NFloat Easing.EaseInOutCubic(NFloat t)

public static nfloat EaseInOutCubic(nfloat t);

Smoothly accelerates and decelerates with a cubic curve.

NFloat Easing.EaseInOutElastic(NFloat t)

public static nfloat EaseInOutElastic(nfloat t);

Combines EaseInElastic and EaseOutElastic for a spring-like bounce effect at both ends.

NFloat Easing.EaseInOutQuad(NFloat t)

public static nfloat EaseInOutQuad(nfloat t);

Accelerates and decelerates using a quadratic curve.

NFloat Easing.EaseInOutQuart(NFloat t)

public static nfloat EaseInOutQuart(nfloat t);

Strong acceleration and deceleration using a quartic curve.

NFloat Easing.EaseInOutSine(NFloat t)

public static nfloat EaseInOutSine(nfloat t);

Eases in and out with a sine curve. Smoothest at beginning and end.

NFloat Easing.EaseInQuad(NFloat t)

public static nfloat EaseInQuad(nfloat t);

Accelerates slowly from 0 to 1 with a quadratic curve.

NFloat Easing.EaseInQuart(NFloat t)

public static nfloat EaseInQuart(nfloat t);

Stronger acceleration from 0 using a quartic curve.

NFloat Easing.EaseOutBack(NFloat t)

public static nfloat EaseOutBack(nfloat t);

Eases out with a slight overshoot after reaching the target.

NFloat Easing.EaseOutBounce(NFloat t)

public static nfloat EaseOutBounce(nfloat t);

Creates a bounce effect as if hitting the ground and bouncing back.

NFloat Easing.EaseOutCubic(NFloat t)

public static nfloat EaseOutCubic(nfloat t);

Decelerates slowly with a cubic curve.

NFloat Easing.EaseOutElastic(NFloat t)

public static nfloat EaseOutElastic(nfloat t);

Creates an elastic "bounce-out" effect at the end of the transition.

NFloat Easing.EaseOutQuad(NFloat t)

public static nfloat EaseOutQuad(nfloat t);

Decelerates smoothly from 1 to 0 with a quadratic curve.

NFloat Easing.EaseOutQuart(NFloat t)

public static nfloat EaseOutQuart(nfloat t);

Stronger deceleration to 1 using a quartic curve.

NFloat Easing.Normalize(NFloat value, NFloat min, NFloat max)

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.

NFloat Easing.SmoothDamp(NFloat from, NFloat to, ref NFloat velocity, NFloat smoothTime, NFloat maxSpeed, NFloat deltaTime)

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.

NFloat Easing.SmootherStep(NFloat t)

public static nfloat SmootherStep(nfloat t);

Applies a smoothstep-like easing function that produces smooth transitions with zero first and second derivatives at boundaries.

readonly struct Easing.CubicBezier

Represents a CSS-style cubic Bé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 and Xui.Core.Animation.Easing.CubicBezier.P2 shape the acceleration and deceleration of the animation.

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; }
}

CubicBezier.CubicBezier(Point p1, Point p2)

public CubicBezier(Point p1, Point p2);

Initializes a new CSS-style cubic Bézier easing curve with the given control points. Assumes endpoints at (0,0) and (1,1).

NFloat CubicBezier.ClosestT(Point target)

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.

CubicBezier CubicBezier.Drag(Point origin, Vector delta)

public CubicBezier Drag(Point origin, Vector delta);

Returns a new cubic Bézier easing curve with a deformation applied near the closest point to origin, shifted by delta.

CubicBezier CubicBezier.DragAt(NFloat t, Vector delta)

public CubicBezier DragAt(nfloat t, Vector delta);

Returns a new cubic Bézier easing curve with a deformation applied at the given parameter t by delta.

CubicBezier CubicBezier.Ease

public static CubicBezier Ease { get; }

Equivalent to CSS ease: cubic-bezier(0.25, 0.1, 0.25, 1.0)

CubicBezier CubicBezier.EaseIn

public static CubicBezier EaseIn { get; }

Equivalent to CSS ease-in: cubic-bezier(0.42, 0, 1.0, 1.0)

CubicBezier CubicBezier.EaseInOut

public static CubicBezier EaseInOut { get; }

Equivalent to CSS ease-in-out: cubic-bezier(0.42, 0, 0.58, 1.0)

CubicBezier CubicBezier.EaseOut

public static CubicBezier EaseOut { get; }

Equivalent to CSS ease-out: cubic-bezier(0, 0, 0.58, 1.0)

NFloat CubicBezier.Evaluate(NFloat x)

public nfloat Evaluate(nfloat x);

Approximates the Y output value for a given input X ∈ [0,1] using a 16-step lookup table.

NFloat CubicBezier.Evaluate(NFloat x, NFloat precision)

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.

NFloat CubicBezier.this[NFloat x]

public nfloat this[nfloat x] { get; }

Indexer alias for Xui.Core.Animation.Easing.CubicBezier.Evaluate(System.Runtime.InteropServices.NFloat).

Point CubicBezier.Lerp(NFloat t)

public Point Lerp(nfloat t);

Returns the interpolated point on the Bézier curve at a given t ∈ [0, 1].

Point CubicBezier.P1

public readonly Point P1;

The first control point (typically near the origin).

Point CubicBezier.P2

public readonly Point P2;

The second control point (typically near the destination).

CubicBezier.implicit operator CubicBezier(CubicBezier bezier)

public static implicit operator CubicBezier(Curves2D.CubicBezier bezier);

Converts a full Xui.Core.Curves2D.CubicBezier into a CSS-style easing curve. The curve must begin at (0,0) and end at (1,1).

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ézier-based easing curves (like Xui.Core.Animation.Easing.CubicBezier) using polynomial coefficients, which are faster to evaluate and easier to store or serialize.

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; }
}

PolynomialEasing.PolynomialEasing(NFloat b, NFloat c, NFloat d, NFloat e)

public PolynomialEasing(nfloat b, nfloat c, nfloat d, nfloat e);

Constructs a 3rd-degree polynomial: y = B·x³ + C·x² + D·x + E

PolynomialEasing.PolynomialEasing(NFloat a, NFloat b, NFloat c, NFloat d, NFloat e)

public PolynomialEasing(nfloat a, nfloat b, nfloat c, nfloat d, nfloat e);

Constructs a 4th-degree polynomial: y = A·x⁴ + B·x³ + C·x² + D·x + E

PolynomialEasing.PolynomialEasing(CubicBezier bezier, int samples = 16)

public PolynomialEasing(CubicBezier bezier, int samples = 16);

Approximates a Xui.Core.Animation.Easing.CubicBezier easing curve using a cubic polynomial. The result fits y = B·x³ + C·x² + D·x + E over the domain x ∈ [0, 1].

  • bezier — The Bézier curve to approximate.

  • samples — Number of sample points to use in least-squares fitting. Default is 16.

NFloat PolynomialEasing.A

public readonly nfloat A;

The coefficient for x⁴ (A = 0 for cubic curves).

NFloat PolynomialEasing.B

public readonly nfloat B;

The coefficient for x³.

NFloat PolynomialEasing.C

public readonly nfloat C;

The coefficient for x².

NFloat PolynomialEasing.D

public readonly nfloat D;

The coefficient for x¹.

NFloat PolynomialEasing.E

public readonly nfloat E;

The constant term.

NFloat PolynomialEasing.this[NFloat x]

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.

class ElasticMotion

Bounded rubber-band displacement for dragging beyond a scrollable range.

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);
}

NFloat ElasticMotion.Resist(NFloat position, NFloat min, NFloat max, NFloat viewport)

public static nfloat Resist(nfloat position, nfloat min, nfloat max, nfloat viewport);

Maps an unconstrained position to a progressively resisted position outside the bounds.

NFloat ElasticMotion.Resist(NFloat position, NFloat min, NFloat max, NFloat viewport, NFloat resistance)

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).

NFloat ElasticMotion.Unresist(NFloat position, NFloat min, NFloat max, NFloat viewport)

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.

NFloat ElasticMotion.Unresist(NFloat position, NFloat min, NFloat max, NFloat viewport, NFloat resistance)

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.

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.

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);
}

ExponentialDecayCurve.ExponentialDecayCurve(TimeSpan startTime, NFloat startPosition, NFloat initialVelocity, NFloat decayPerSecond, double velocityThreshold = 0.5)

[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.

  • velocityThreshold — The velocity below which motion is considered stopped (defaults to 0.5).

NFloat ExponentialDecayCurve.DecayPerSecond

public readonly nfloat DecayPerSecond;

The decay factor per second. Lower values result in faster deceleration.

TimeSpan ExponentialDecayCurve.EndTime

public readonly TimeSpan EndTime;

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

NFloat ExponentialDecayCurve.Fast

public static readonly nfloat Fast;

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

NFloat ExponentialDecayCurve.FinalPosition

public nfloat FinalPosition { get; }

Gets the final position of the motion at Xui.Core.Animation.ExponentialDecayCurve.EndTime.

NFloat ExponentialDecayCurve.InitialVelocity

public readonly nfloat InitialVelocity;

The initial velocity at the start of the curve.

NFloat ExponentialDecayCurve.this[TimeSpan time]

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.

NFloat ExponentialDecayCurve.Normal

public static readonly nfloat Normal;

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

NFloat ExponentialDecayCurve.StartPosition

public readonly nfloat StartPosition;

The starting position of the motion.

TimeSpan ExponentialDecayCurve.StartTime

public readonly TimeSpan StartTime;

The time at which the motion begins.

NFloat ExponentialDecayCurve.VelocityAt(TimeSpan time)

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.

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.

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);
}

QuadraticMotionCurve.QuadraticMotionCurve(TimeSpan startTime, NFloat startPosition, NFloat startVelocity, NFloat accelerationMagnitude)

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.

QuadraticMotionCurve.QuadraticMotionCurve(TimeSpan startTime, TimeSpan endTime, NFloat a, NFloat b, NFloat c)

[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.

NFloat QuadraticMotionCurve.A

public readonly nfloat A;

The quadratic coefficient (0.5 * acceleration).

NFloat QuadraticMotionCurve.B

public readonly nfloat B;

The linear coefficient (initial velocity minus adjustment).

NFloat QuadraticMotionCurve.C

public readonly nfloat C;

The constant coefficient (initial position minus offset).

TimeSpan QuadraticMotionCurve.EndTime

public readonly TimeSpan EndTime;

The time at which the motion ends (i.e., when velocity reaches zero).

NFloat QuadraticMotionCurve.FinalPosition

public nfloat FinalPosition { get; }

Gets the final position of the motion at Xui.Core.Animation.QuadraticMotionCurve.EndTime.

NFloat QuadraticMotionCurve.this[TimeSpan time]

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.

TimeSpan QuadraticMotionCurve.StartTime

public readonly TimeSpan StartTime;

The time at which the motion starts.

NFloat QuadraticMotionCurve.VelocityAt(TimeSpan time)

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.

readonly struct SpringMotionCurve

A critically damped spring evaluated analytically, independent of display refresh rate.

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);
}

SpringMotionCurve.SpringMotionCurve(TimeSpan startTime, NFloat position, NFloat velocity, NFloat target)

public SpringMotionCurve(TimeSpan startTime, nfloat position, nfloat velocity, nfloat target);

Creates a spring preserving initial position and velocity.

bool SpringMotionCurve.IsComplete(TimeSpan time)

public bool IsComplete(TimeSpan time);

Whether the curve is close enough to finish at its exact target.

NFloat SpringMotionCurve.this[TimeSpan time]

public nfloat this[TimeSpan time] { get; }

Evaluates the position at an absolute frame time.

TimeSpan SpringMotionCurve.StartTime

public TimeSpan StartTime { get; }

The time at which the rebound starts.

NFloat SpringMotionCurve.Target

public nfloat Target { get; }

The exact resting position.

NFloat SpringMotionCurve.VelocityAt(TimeSpan time)

public nfloat VelocityAt(TimeSpan time);

Evaluates the velocity in units per second.