19 lines
457 B
TypeScript
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 };
|
|
};
|