Files
3f2ead6d-8a2b-46e6-ba7c-e63…/src/components/cardStack/hooks/useCardAnimation.ts

19 lines
457 B
TypeScript

import { useEffect, useRef } from 'react';
interface UseCardAnimationOptions {
perspective?: number;
}
export const useCardAnimation = (options: UseCardAnimationOptions = {}) => {
const { perspective = 1000 } = options;
const containerRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!containerRef.current) return;
containerRef.current.style.perspective = `${perspective}px`;
}, [perspective]);
return { containerRef };
};