import * as eases from 'eases'; import { IDisposable } from './Disposable'; import { Timer } from './Timer'; /** type to get all keys for all properties of type V on target T **/ type KeysMatching = { [K in keyof T]: T[K] extends V ? K : never; }[keyof T]; /** type to be just the number properties of a target T, but all optional. */ type TargetProps = Partial>>; /** * A class for tweening object properties. This runs off of the globalTimer Timer variable, so make sure that is * running or being ticked. * * Usage: * ``` * Tween.get(myObj).to({x: 5, y: 10}, 2, 'quadInOut').promise; * ``` */ export declare class Tween implements IDisposable { static tweens: Set>; paused: boolean; private target; private steps; private currentStep; private loop; private onComplete; private timerListener; private _promise; private _resolve; constructor(target: any); static get(target: T, options?: TweenOptions): Tween; static removeTweens(target: any): void; static removeAllTweens(): void; /** * Tweens one or more properties to the given value. * @param targetValues Properties corresponding end values to tween to. * @param totalTime Time in seconds to perform tweening. * @param ease Name of ease method to apply to interpolation. * @param tick Function to call each update while this step is active. */ to: (targetValues: TargetProps, totalTime: number, ease?: Ease, tick?: ((t: number) => void) | undefined) => this; /** * Waits a number of seconds before continuing. * @param totalTime Time to wait, in seconds. */ wait: (totalTime: number) => this; /** * Performs a callback when this step is reached. */ call: (call: () => void) => this; /** * Gets a promise for when the tween is fully complete. */ get promise(): Promise; private doComplete; private update; /** * Stops and cleans up the tween. */ destroy(): void; /** * Stops and cleans up the tween. */ dispose(): void; } export type TweenStep = { targetValues?: any; initialValues?: any; currentTime?: number; totalTime?: number; ease?: (t: number) => number; call?: () => void; tick?: (t: number) => void; }; export type TweenOptions = { /** * If this should replace any existing tween on the same object */ override?: boolean; /** Number of times to loop, or true for infinite */ loop?: number | true; /** Callback for a complete tween. Use of promises/.call() are suggested instead. */ onComplete?: () => void; /** Override what timer to listen to - defaults to the global timer. */ timer?: Timer; }; export type Ease = keyof typeof eases; export {};