Struct Easing.CubicBezier
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
Fields
P1
The first control point (typically near the origin).
public readonly Point P1
Field Value
P2
The second control point (typically near the destination).
public readonly Point P2
Field Value
Properties
Ease
Equivalent to CSS ease
: cubic-bezier(0.25, 0.1, 0.25, 1.0)
public static Easing.CubicBezier Ease { get; }
Property Value
EaseIn
Equivalent to CSS ease-in
: cubic-bezier(0.42, 0, 1.0, 1.0)
public static Easing.CubicBezier EaseIn { get; }
Property Value
EaseInOut
Equivalent to CSS ease-in-out
: cubic-bezier(0.42, 0, 0.58, 1.0)
public static Easing.CubicBezier EaseInOut { get; }
Property Value
EaseOut
Equivalent to CSS ease-out
: cubic-bezier(0, 0, 0.58, 1.0)
public static Easing.CubicBezier EaseOut { get; }
Property Value
this[NFloat]
Indexer alias for Evaluate(NFloat).
public NFloat this[NFloat x] { get; }
Parameters
x
NFloat
Property Value
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
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
Returns
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
Returns
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
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
Returns
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
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