Files
GNX-WEB/frontEnd/components/shared/layout/animations/FadeImageBottom.tsx
Iliyan Angelov 366f28677a update
2025-11-24 03:52:08 +02:00

39 lines
872 B
TypeScript

"use client";
import { useEffect } from "react";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/dist/ScrollTrigger";
const FadeImageBottom = () => {
useEffect(() => {
gsap.registerPlugin(ScrollTrigger);
const deviceWidth = window.innerWidth;
if (
document.querySelectorAll(".fade-img").length > 0 &&
deviceWidth >= 992
) {
gsap.utils.toArray(".fade-img").forEach((el: any) => {
const tl = gsap.timeline({
scrollTrigger: {
trigger: el,
start: "center center",
end: "+=40%",
scrub: 1,
pin: false,
invalidateOnRefresh: true,
},
});
tl.to(el, {
y: "120px",
zIndex: "-1",
duration: 1,
});
});
}
}, []);
return null;
};
export default FadeImageBottom;