Api Sandbox Curve
struct

Curve

public sealed struct Curve

Describes a curve, which can have multiple key frames.

Constructors

Curve(ImmutableArray<Frame> frames)
Curve(IEnumerable<Frame> frames)
Curve(Frame[] frames)
Curve()

Properties

Name Type Description
TimeRange Vector2 The range of this curve. This affects looping.
ValueRange Vector2 The value range. This should affect nothing but what it looks like in the editor.
Length Int32 Amount of key frames or points on the curve.
Item Frame

Methods

Curve WithFrames(ImmutableList<Frame> frames)
Curve WithFrames(ImmutableArray<Frame> frames)
Curve WithFrames(IEnumerable<Frame> frames)
Curve Reverse()

Make a copy of this curve that is reversed (If input eases from 0 to 1 then output will ease from 1 to 0)

Int32 AddPoint(Single x, Single y)

Add a new keyframe at given position to this curve.

x — Position of the keyframe on the X axis.
y — Position of the keyframe on the Y axis.
returns — The position of newly added keyframe in the Frames list.
Int32 AddPoint(Frame keyframe)

Add given keyframe to this curve.

keyframe — The keyframe to add.
returns — The position of newly added keyframe in the Frames list.
Void RemoveAtTime(Single time, Single within)

Remove all of the frames at the current time

Void Sort()

Make sure we're all sorted by time

Boolean AddOrReplacePoint(Frame keyframe)

Add given keyframe to this curve.

returns — True if we added a new point. False if we just edited an existing point.
Single Evaluate(Single time, Boolean angles)

Returns the value on the curve at given time position.

time — The time point (x axis) at which
angles — Is this an angle?
returns — The absolute value at given time. (y axis)
Single Evaluate(Single time)

Returns the value on the curve at given time position.

time — The time point (x axis) at which
returns — The absolute value at given time. (y axis)
Single EvaluateDelta(Single time)

Like evaluate but takes a normalized time between 0 and 1 and returns a normalized value between 0 and 1

Single EvaluateDelta(Single time, Boolean angles)

Like evaluate but takes a normalized time between 0 and 1 and returns a normalized value between 0 and 1

Void Fix()

If the curve is broken in some way, we can fix it here. Ensures correct time and value ranges, and that the curve has at least one point.

Void UpdateValueRange(Vector2 newRange, Boolean retainValues)
Void UpdateTimeRange(Vector2 newRange, Boolean retainTimes)

Fields

Name Type Description
Linear static Curve A curve that linearly interpolates from 0 to 1
Ease static Curve A curve that eases from 0 to 1
EaseIn static Curve A curve that eases in from 0 to 1
EaseOut static Curve A curve that eases out from 0 to 1
Frames ImmutableArray<Frame> A list of keyframes or points on the curve.
Assembly: Sandbox.System Namespace: Sandbox Full Name: Sandbox.Curve