react-rebound
Version:
High-performance spring animations in React.
20 lines (19 loc) • 911 B
TypeScript
import { MutableRefObject } from 'react';
import { Spring } from 'rebound';
import MultiSpring from './MultiSpring';
import { AnimatableProps } from './style';
declare type SpringForProp<Prop extends keyof AnimatableProps> = AnimatableProps[Prop] extends number[] ? MultiSpring<AnimatableProps[Prop]> : Spring;
export declare function useAnimation<Props extends keyof Partial<AnimatableProps>>(ref: MutableRefObject<HTMLElement | undefined | null>, props: {
[prop in Props]: AnimatableProps[prop];
}, { animate, tension, friction, delay, displacementThreshold, speedThreshold, clamp, onStart, onEnd, }?: {
animate?: boolean;
tension?: number;
friction?: number;
delay?: number;
displacementThreshold?: number;
speedThreshold?: number;
clamp?: boolean;
onStart?: () => void;
onEnd?: () => void;
}): { [Prop in Props]: SpringForProp<Prop>; };
export {};