Vixen
02b45cc4
csharp
public sealed class AnimationCurve

A value over time, as keys with tangents between them.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Cubic Hermite between neighbours, which is what every animation system in this shape uses and what makes a tangent mean what an artist expects: the slope at the key. Bézier control points are the same curve wearing different numbers, and the conversion is a third of the interval — but slopes are what survive a key being dragged sideways.

⚠ Outside the first and last key the curve holds rather than extrapolating. A cubic extrapolated past its last key runs off to infinity within a second or two, and an animation that was sampled one frame past its end would send whatever it drives into the next county. Clamping is the boring answer and the right one.

Fields and properties (1)

  • public IReadOnlyList<CurveKey> Keys

    The keys, in time order.

Events (1)

Methods (14)

  • public AnimationCurve()

    Creates an empty curve.

  • public AnimationCurve(params ReadOnlySpan<CurveKey> source)

    Creates a curve from some keys.

  • public static AnimationCurve Linear()

    A straight line from (0,0) to (1,1).

  • public static AnimationCurve EaseIn()

    A curve that starts slowly.

  • public static AnimationCurve EaseOut()

    A curve that ends slowly.

  • public static AnimationCurve EaseInOut()

    A curve that starts and ends slowly. The default for almost everything.

  • public static AnimationCurve Step()

    A single step in the middle.

  • public int Add(CurveKey key)

    Adds a key.

  • public CurveKey Add(float time, float value)

    Adds a key at a time and value.

  • public bool Remove(CurveKey key)

    Removes a key.

  • public void Move(CurveKey key, float time, float value)

    Moves a key and puts it back in time order.

  • public void Touch()

    Tells subscribers something changed, for an edit made through a key directly.

  • public float Evaluate(float time)

    The value at a time.

  • public (float Outgoing, float Incoming) Slopes(int index)

    The two slopes that actually govern a segment, after the modes have had their say.

Used by (12)

  • AnimationCurveTestsVixen.Ui.Controls.Advanced.Tests
  • CurveEditorVixen.Ui.Controls.Advanced
  • CurveEditorTestsVixen.Ui.Controls.Advanced.Tests
  • TimelineLanesVixen.Ui.Controls.Advanced
  • TimelineTrackVixen.Ui.Controls.Advanced
  • AnimationClipCurvesVixen.Editor.AssetEditors
  • AnimationClipDocumentVixen.Editor.AssetEditors
  • AnimationClipViewVixen.Editor.AssetEditors
  • CurveDrawerVixen.Editor.Inspector
  • Describes_Vixen_Editor_Inspector_Tests_WaterMaterialVixen.Editor.Inspector.Tests
  • DrawerRegistryVixen.Editor.Inspector
  • WaterMaterialVixen.Editor.Inspector.Tests