A curve that contains a set of keyframes and can evaluate values at specific timestamps.

// Example of using Animation Curve

// creating keyframes
var A = AnimationCurve.createKeyFrame();
var B = AnimationCurve.createKeyFrame();

// creating AnimationCurve
var curve = AnimationCurve.create();
A.time = 0.0;
A.value = 0.0;

B.time = 1.0;
B.value = 1.0;

curve.addKeyframe(A);
curve.addKeyframe(B);
let idxB = curve.addKeyframe(B);

// evaluating value
var value = curve.evaluate(0.5);
interface AnimationCurve {
    keyFrameCount: number;
    addKeyframe(frame: AnimationKeyFrame): void;
    evaluate(time: number): number;
    getKeyFrame(index: number): AnimationKeyFrame;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    removeKeyFrame(t: number): void;
}

Hierarchy (view full)

Properties

keyFrameCount: number

The number of keyframes in the animation curve.

Methods

  • Adds keyframe to the curve.

    Parameters

    Returns void

  • Evaluate value of the curve at specific point.

    Parameters

    • time: number

    Returns number

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

  • Remove animation keyframe at specific timestamp. The closest keyframe will be deleted.

    Parameters

    • t: number

    Returns void