use-scroll-to-2
Version:
Scroll to React elements with custom timing function support
15 lines (14 loc) • 515 B
TypeScript
import bezier from "bezier-easing";
import { RefObject } from "react";
export declare type AnimationOptions = {
delay: number;
duration: number;
easing: bezier.EasingFunction;
};
declare type HookOptions = {
auto?: boolean;
offsetLeft?: number | ((direction: number) => number);
offsetTop?: number | ((direction: number) => number);
} & Partial<AnimationOptions>;
export declare function useScrollTo<T extends HTMLElement>(opts?: HookOptions): [RefObject<T>, () => void];
export { bezier };