Skip to content

Commit

Permalink
lastT
Browse files Browse the repository at this point in the history
  • Loading branch information
barchakuz committed May 12, 2024
1 parent a7a44cc commit bb0514e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/components/ui/3d-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import React, {
createContext,
useState,
useContext,
useRef,
useEffect,
useRef
} from "react";
import { useEffect } from "react";

const MouseEnterContext = createContext<
[boolean, React.Dispatch<React.SetStateAction<boolean>>] | undefined
Expand Down Expand Up @@ -121,18 +121,18 @@ export const CardItem = ({
const ref = useRef<HTMLDivElement>(null);
const [isMouseEntered] = useMouseEnter();



useEffect(() => {
handleAnimations();
}, [isMouseEntered]);

const handleAnimations = () => {
if (!ref.current) return;
function handleAnimations(){
if (!ref.current) return;
if (isMouseEntered) {
ref.current.style.transform = `translateX(${translateX}px) translateY(${translateY}px) translateZ(${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) rotateZ(${rotateZ}deg)`;
} else {
ref.current.style.transform = `translateX(0px) translateY(0px) translateZ(0px) rotateX(0deg) rotateY(0deg) rotateZ(0deg)`;
}
};
};
}, [isMouseEntered]); // Include handleAnimations in the dependency array

return (
<Tag
Expand Down

0 comments on commit bb0514e

Please sign in to comment.