playcanvas-typings
Version:
TypeScript declaration files for PlayCanvas game engine
86 lines (77 loc) • 2.59 kB
TypeScript
declare namespace pc {
/**
* @enum pc.CURVE
* @name pc.CURVE_LINEAR
* @description A linear interpolation scheme.
*/
const CURVE_LINEAR = 0;
/**
* @enum pc.CURVE
* @name pc.CURVE_SMOOTHSTEP
* @description A smooth step interpolation scheme.
*/
const CURVE_SMOOTHSTEP = 1;
/**
* @enum pc.CURVE
* @name pc.CURVE_CATMULL
* @description A Catmull-Rom spline interpolation scheme.
*/
const CURVE_CATMULL = 2;
/**
* @enum pc.CURVE
* @name pc.CURVE_CARDINAL
* @description A cardinal spline interpolation scheme.
*/
const CURVE_CARDINAL = 3;
/**
* @name pc.Curve
* @class A curve is a collection of keys (time/value pairs). The shape of the
* curve is defined by its type that specifies an interpolation scheme for the keys.
* @description Creates a new curve.
* @param {Number[]} [data] An array of keys (pairs of numbers with the time first and
* value second)
* @property {Number} length The number of keys in the curve. [read only]
*/
class Curve {
constructor(data?: number[])
length: number;
/**
* @function
* @name pc.Curve#add
* @description Add a new key to the curve.
* @param {Number} time Time to add new key
* @param {Number} value Value of new key
* @returns {Number[]} [time, value] pair
*/
add(time: number, value: number): number[];
/**
* @function
* @name pc.Curve#get
* @description Return a specific key.
* @param {Number} index The index of the key to return
* @returns {Number[]} The key at the specified index
*/
get(index: number): number[];
/**
* @function
* @name pc.Curve#sort
* @description Sort keys by time.
*/
sort(): void;
/**
* @function
* @name pc.Curve#value
* @description Returns the interpolated value of the curve at specified time.
* @param {Number} time The time at which to calculate the value
* @return {Number} The interpolated value
*/
value(time: number): number;
/**
* @function
* @name pc.Curve#clone
* @description Returns a clone of the specified curve object.
* @returns {pc.Curve} A clone of the specified curve
*/
clone(): pc.Curve;
}
}