62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
/** A single keyframe descriptor passed to the Animation constructor. */
|
|
interface AnimationKeyframe {
|
|
/** Time offset in seconds. */
|
|
time: number;
|
|
/** Value at this keyframe. */
|
|
value: number;
|
|
/** Easing type (EASING_* constant). Defaults to EASING_LINEAR. */
|
|
easing?: number;
|
|
}
|
|
|
|
/** Keyframe-based float animation. */
|
|
interface AnimationInstance {
|
|
/**
|
|
* Interpolates the animation at the given time.
|
|
* @param time Time in seconds.
|
|
* @returns Interpolated value.
|
|
*/
|
|
getValue(time: number): number;
|
|
}
|
|
|
|
/** Constructs a new Animation from an array of keyframe descriptors. */
|
|
declare var Animation: {
|
|
new (keyframes: AnimationKeyframe[]): AnimationInstance;
|
|
};
|
|
|
|
/** Easing function utilities. */
|
|
interface EasingNamespace {
|
|
/**
|
|
* Applies the given easing function to normalized time t.
|
|
* @param type An EASING_* constant.
|
|
* @param t Normalized time in [0, 1].
|
|
* @returns Eased value in [0, 1].
|
|
*/
|
|
apply(type: number, t: number): number;
|
|
}
|
|
|
|
declare var Easing: EasingNamespace;
|
|
|
|
declare var EASING_LINEAR: number;
|
|
declare var EASING_IN_SINE: number;
|
|
declare var EASING_OUT_SINE: number;
|
|
declare var EASING_IN_OUT_SINE: number;
|
|
declare var EASING_IN_QUAD: number;
|
|
declare var EASING_OUT_QUAD: number;
|
|
declare var EASING_IN_OUT_QUAD: number;
|
|
declare var EASING_IN_CUBIC: number;
|
|
declare var EASING_OUT_CUBIC: number;
|
|
declare var EASING_IN_OUT_CUBIC: number;
|
|
declare var EASING_IN_QUART: number;
|
|
declare var EASING_OUT_QUART: number;
|
|
declare var EASING_IN_OUT_QUART: number;
|
|
declare var EASING_IN_BACK: number;
|
|
declare var EASING_OUT_BACK: number;
|
|
declare var EASING_IN_OUT_BACK: number;
|