From 6c80a6ab7930cb43a2d388057bd0526b4e5c93ff Mon Sep 17 00:00:00 2001 From: bender Date: Mon, 9 Mar 2026 08:22:19 +0000 Subject: [PATCH] Update src/components/cardStack/hooks/useCardAnimation.ts --- .../cardStack/hooks/useCardAnimation.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/cardStack/hooks/useCardAnimation.ts b/src/components/cardStack/hooks/useCardAnimation.ts index 7502737..2cc0f4a 100644 --- a/src/components/cardStack/hooks/useCardAnimation.ts +++ b/src/components/cardStack/hooks/useCardAnimation.ts @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; interface Depth3DAnimationOptions { rotationX?: number; @@ -11,6 +11,10 @@ interface Depth3DAnimationOptions { interface AnimationState { transform: string; transition: string; + itemRefs?: React.MutableRefObject<(HTMLElement | null)[]>; + containerRef?: React.MutableRefObject; + perspectiveRef?: React.MutableRefObject; + bottomContentRef?: React.MutableRefObject; } export const useCardAnimation = ( @@ -19,6 +23,11 @@ export const useCardAnimation = ( const [state, setState] = useState({ transform: "", transition: ""}); + const itemRefs = useRef<(HTMLElement | null)[]>([]); + const containerRef = useRef(null); + const perspectiveRef = useRef(null); + const bottomContentRef = useRef(null); + const { rotationX = 0, rotationY = 0, @@ -32,6 +41,10 @@ export const useCardAnimation = ( setState({ transform, transition: `transform ${duration}s ease-out`, + itemRefs, + containerRef, + perspectiveRef, + bottomContentRef, }); }, [rotationX, rotationY, rotationZ, perspective, duration]);