UNPKG

@ssgoi/core

Version:

Core animation engine for SSGOI - Native app-like page transitions with spring physics

40 lines 1.53 kB
export type TransitionKey = string | symbol; export type SpringConfig = { stiffness?: number; damping?: number; }; export type TransitionConfig<TAnimationValue = number> = { spring?: SpringConfig; from?: TAnimationValue; to?: TAnimationValue; tick?: (progress: TAnimationValue) => void; prepare?: (element: HTMLElement) => void; onStart?: () => void; onEnd?: () => void; }; export type GetTransitionConfig<TContext = undefined, TAnimationValue = number> = TContext extends undefined ? (node: HTMLElement) => TransitionConfig<TAnimationValue> | Promise<TransitionConfig<TAnimationValue>> : (node: HTMLElement, context: TContext) => TransitionConfig<TAnimationValue> | Promise<TransitionConfig<TAnimationValue>>; export type Transition<TContext = undefined, TAnimationValue = number> = { in?: GetTransitionConfig<TContext, TAnimationValue>; out?: GetTransitionConfig<TContext, TAnimationValue>; }; export type TransitionCallback = (element: HTMLElement | null) => void | (() => void); export type SggoiTransitionContext = { scrollOffset: { x: number; y: number; }; }; export type SggoiTransition = Transition<SggoiTransitionContext>; export type SsgoiConfig = { transitions: { from: string; to: string; transition: SggoiTransition; symmetric?: boolean; }[]; defaultTransition?: SggoiTransition; }; export type SsgoiContext = (path: string) => Transition & { key: TransitionKey; }; //# sourceMappingURL=types.d.ts.map