diff --git a/src/Components/Home.jsx b/src/Components/Home.jsx index a5aca8d..9c55ce4 100644 --- a/src/Components/Home.jsx +++ b/src/Components/Home.jsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React, { useEffect, useRef } from "react"; import Footer from "./Footer"; import Vision from "./Vision"; import ScrollToTopButton from "./gototop"; @@ -6,9 +6,32 @@ import AOS from "aos"; import "aos/dist/aos.css"; export default function Home() { + const tiltCard = useRef(); useEffect(() => { AOS.init(); + const card = tiltCard.current; + card.addEventListener("mousemove", (e) => { + const rect = card.getBoundingClientRect(); + const x = e.clientX - rect.left; // X position inside the card + const y = e.clientY - rect.top; // Y position inside the card + const centerX = rect.width / 2; + const centerY = rect.height / 2; + + // Calculate rotation values + const rotateX = ((y - centerY) / centerY) * 10; // tilt up/down + const rotateY = ((x - centerX) / centerX) * -10; // tilt left/right + + card.style.transform = `rotateX(${rotateX}deg) rotateY(${rotateY}deg)`; + card.style.boxShadow = `${-rotateY * 2}px ${ + rotateX * 2 + }px 30px rgba(0, 0, 0, 0.4)`; + }); + + card.addEventListener("mouseleave", () => { + card.style.transform = "rotateX(0) rotateY(0)"; + card.style.boxShadow = "0 15px 25px rgba(0, 0, 0, 0.3)"; + }); }, []); return ( @@ -30,19 +53,31 @@ export default function Home() {
- -
- ... +
+
+ ... +
+
@@ -51,7 +86,9 @@ export default function Home() {
-

Why GDSC?

+

+ Why GDSC? +


By joining GDSC at SMIT, you gain access to numerous workshops, information sessions, and student-community collaborative projects @@ -60,7 +97,9 @@ export default function Home() {
-

Concept of GDSC

+

+ Concept of GDSC +


The purpose of GDSC is to inspire and empower students through understanding technology and reflecting on it's impact @@ -72,10 +111,15 @@ export default function Home() {
-
-