public readonly record struct TimingFunctionMaps progress through a duration onto progress through a change.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The two are not the same thing and conflating them is what makes UI motion feel wrong. Halfway through the time is not halfway through the movement — real things accelerate and settle — and a timing function is the curve that says by how much.
Springs are Vixen's extension, and the case for them in a game UI is that they are the only easing whose parameters are physical. A designer asking for "snappier" adjusts a stiffness; the same request against a cubic-bezier is four numbers found by guessing. They also compose properly with an interruption — a spring retargeted mid-flight carries its velocity, where a Bézier restarts from a standstill and visibly stutters.
Fields and properties (15)
public TimingFunctionKind KindWhat shape it is.
public float X1The first control point's x.
public float Y1The first control point's y.
public float X2The second control point's x.
public float Y2The second control point's y.
public int StepsHow many steps.
public StepPosition PositionWhere a step jumps.
public float MassThe spring's mass.
public float StiffnessThe spring's stiffness.
public float DampingThe spring's damping coefficient.
public static TimingFunction LinearConstant speed. CSS's linear.
public static TimingFunction EaseCSS's ease.
public static TimingFunction EaseInCSS's ease-in.
public static TimingFunction EaseOutCSS's ease-out.
public static TimingFunction EaseInOutCSS's ease-in-out.
Methods (6)
public static TimingFunction Bezier(float x1, float y1, float x2, float y2)A cubic Bézier.
public static TimingFunction Step(int count, StepPosition position)A step function.
public static TimingFunction Spring(float mass, float stiffness, float damping)A damped spring.
public float Evaluate(float progress)Maps elapsed progress onto progress through the change.
public float SettlingDuration()How long a spring takes to settle.
public override string ToString()Returns the fully qualified type name of this instance.
Used by (7)
- AnimationSpecVixen.Ui.Styling
- AnimatorVixen.Ui.Styling
- RunningTransitionVixen.Ui.Styling
- TimingFunctionTestsVixen.Ui.Styling.Tests
- TransitionParserVixen.Ui.Styling
- TransitionSpecVixen.Ui.Styling
- TransitionTestsVixen.Ui.Styling.Tests