Table of Contents

Struct Easing.CubicBezier

Namespace
Xui.Core.Animation
Assembly
Core.dll

Represents a CSS-style cubic Bézier easing curve constrained between (0,0) and (1,1).

public readonly struct Easing.CubicBezier
Inherited Members

Remarks

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 P1 and P2 shape the acceleration and deceleration of the animation.

Constructors

CubicBezier(Point, Point)

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

public CubicBezier(Point p1, Point p2)

Parameters

p1 Point
p2 Point

Fields

P1

The first control point (typically near the origin).

public readonly Point P1

Field Value

Point

P2

The second control point (typically near the destination).

public readonly Point P2

Field Value

Point

Properties

Ease

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

public static Easing.CubicBezier Ease { get; }

Property Value

Easing.CubicBezier

EaseIn

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

public static Easing.CubicBezier EaseIn { get; }

Property Value

Easing.CubicBezier

EaseInOut

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

public static Easing.CubicBezier EaseInOut { get; }

Property Value

Easing.CubicBezier

EaseOut

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

public static Easing.CubicBezier EaseOut { get; }

Property Value

Easing.CubicBezier

this[NFloat]

Indexer alias for Evaluate(NFloat).

public NFloat this[NFloat x] { get; }

Parameters

x NFloat

Property Value

NFloat

Methods

ClosestT(Point)

Finds the parameter t ∈ [0, 1] where the curve is closest to the given target point. Uses 16-step approximation.

public NFloat ClosestT(Point target)

Parameters

target Point

Returns

NFloat

Drag(Point, Vector)

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

public Easing.CubicBezier Drag(Point origin, Vector delta)

Parameters

origin Point
delta Vector

Returns

Easing.CubicBezier

DragAt(NFloat, Vector)

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

public Easing.CubicBezier DragAt(NFloat t, Vector delta)

Parameters

t NFloat
delta Vector

Returns

Easing.CubicBezier

Evaluate(NFloat)

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

public NFloat Evaluate(NFloat x)

Parameters

x NFloat

Returns

NFloat

Evaluate(NFloat, NFloat)

Approximates the Y output value for a given input X ∈ [0,1] using binary search to the given precision.

public NFloat Evaluate(NFloat x, NFloat precision)

Parameters

x NFloat
precision NFloat

Returns

NFloat

Lerp(NFloat)

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

public Point Lerp(NFloat t)

Parameters

t NFloat

Returns

Point

Operators

implicit operator CubicBezier(CubicBezier)

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

public static implicit operator Easing.CubicBezier(CubicBezier bezier)

Parameters

bezier CubicBezier

Returns

Easing.CubicBezier