@nativescript-community/additween
Version:
Additive tweening library for smooth animations
19 lines (18 loc) • 722 B
TypeScript
import type { IStateReducer } from "./PlainObjectReducer";
export type EasingFunction = (t: number) => number;
export 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;
now(): number;
}