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
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. Int32 AddPoint(Frame keyframe) Add given keyframe to this curve.
keyframe — The keyframe to add. 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.
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? Single Evaluate(Single time) Returns the value on the curve at given time position.
time — The time point (x axis) at which 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. |