UNPKG

additween

Version:

Additive tweening library for smooth animations

18 lines (17 loc) 714 B
import type { IStateReducer } from "./PlainObjectReducer"; export declare type EasingFunction = (t: number) => number; export declare type TAdditiveTweeningOptions<T extends Record<string, number>> = { onRender: (state: T) => void; onFinish?: (finalState: T) => void; onCancel?: () => void; stateReducer?: IStateReducer<T>; }; export declare class AdditiveTweening<T extends Record<string, number>> { tween: (fromState: T, toState: T, duration: number, easing?: EasingFunction) => void; isTweening: () => boolean; finish: () => void; cancel: () => void; constructor(options: TAdditiveTweeningOptions<T>); scheduleAnimationFrame(cb: () => void): number; now(): number; }