Adding animation and v1 of all pages done
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
import React, { useRef, useEffect } from "react";
|
||||
import { gsap } from "gsap";
|
||||
import { ScrollTrigger } from "gsap/ScrollTrigger";
|
||||
|
||||
gsap.registerPlugin(ScrollTrigger);
|
||||
|
||||
interface AnimatedContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
children: React.ReactNode;
|
||||
container?: Element | string | null;
|
||||
distance?: number;
|
||||
direction?: "vertical" | "horizontal" | "none";
|
||||
reverse?: boolean;
|
||||
duration?: number;
|
||||
ease?: string;
|
||||
initialOpacity?: number;
|
||||
animateOpacity?: boolean;
|
||||
scale?: number;
|
||||
threshold?: number;
|
||||
delay?: number;
|
||||
disappearAfter?: number;
|
||||
disappearDuration?: number;
|
||||
disappearEase?: string;
|
||||
onComplete?: () => void;
|
||||
onDisappearanceComplete?: () => void;
|
||||
}
|
||||
|
||||
const AnimatedContent: React.FC<AnimatedContentProps> = ({
|
||||
children,
|
||||
container,
|
||||
distance = 100,
|
||||
direction = "vertical",
|
||||
reverse = false,
|
||||
duration = 0.8,
|
||||
ease = "power3.out",
|
||||
initialOpacity = 0,
|
||||
animateOpacity = true,
|
||||
scale = 1,
|
||||
threshold = 0.1,
|
||||
delay = 0,
|
||||
disappearAfter = 0,
|
||||
disappearDuration = 0.5,
|
||||
disappearEase = "power3.in",
|
||||
onComplete,
|
||||
onDisappearanceComplete,
|
||||
className = "",
|
||||
...props
|
||||
}) => {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const el = ref.current;
|
||||
if (!el) return;
|
||||
|
||||
let scrollerTarget: Element | string | null =
|
||||
container || document.getElementById("snap-main-container") || null;
|
||||
|
||||
if (typeof scrollerTarget === "string") {
|
||||
scrollerTarget = document.querySelector(scrollerTarget);
|
||||
}
|
||||
|
||||
const startPct = (1 - threshold) * 100;
|
||||
const setConfig: gsap.TweenVars = {
|
||||
opacity: animateOpacity ? initialOpacity : 1,
|
||||
visibility: "visible",
|
||||
};
|
||||
|
||||
const toConfig: gsap.TweenVars = {
|
||||
opacity: 1,
|
||||
duration,
|
||||
ease,
|
||||
};
|
||||
if (direction !== "none") {
|
||||
const axis = direction === "horizontal" ? "x" : "y";
|
||||
const offset = reverse ? -distance : distance;
|
||||
setConfig[axis] = offset;
|
||||
toConfig[axis] = 0;
|
||||
}
|
||||
if (scale !== 1) {
|
||||
setConfig.scale = scale;
|
||||
toConfig.scale = 1;
|
||||
}
|
||||
|
||||
gsap.set(el, setConfig);
|
||||
|
||||
const tl = gsap.timeline({
|
||||
paused: true,
|
||||
delay,
|
||||
onComplete: () => {
|
||||
if (onComplete) onComplete();
|
||||
if (disappearAfter > 0) {
|
||||
const disappearConfig: gsap.TweenVars = {
|
||||
opacity: animateOpacity ? initialOpacity : 0,
|
||||
delay: disappearAfter,
|
||||
duration: disappearDuration,
|
||||
ease: disappearEase,
|
||||
onComplete: () => onDisappearanceComplete?.(),
|
||||
};
|
||||
|
||||
if (direction !== "none") {
|
||||
const axis = direction === "horizontal" ? "x" : "y";
|
||||
disappearConfig[axis] = reverse ? distance : -distance;
|
||||
}
|
||||
|
||||
if (scale !== 1) {
|
||||
disappearConfig.scale = 0.8;
|
||||
}
|
||||
|
||||
gsap.to(el, disappearConfig);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
tl.to(el, toConfig);
|
||||
|
||||
const st = ScrollTrigger.create({
|
||||
trigger: el,
|
||||
scroller: scrollerTarget || window,
|
||||
start: `top ${startPct}%`,
|
||||
once: true,
|
||||
onEnter: () => tl.play(),
|
||||
});
|
||||
|
||||
return () => {
|
||||
st.kill();
|
||||
tl.kill();
|
||||
};
|
||||
}, [
|
||||
container,
|
||||
distance,
|
||||
direction,
|
||||
reverse,
|
||||
duration,
|
||||
ease,
|
||||
initialOpacity,
|
||||
animateOpacity,
|
||||
scale,
|
||||
threshold,
|
||||
delay,
|
||||
disappearAfter,
|
||||
disappearDuration,
|
||||
disappearEase,
|
||||
onComplete,
|
||||
onDisappearanceComplete,
|
||||
]);
|
||||
|
||||
return (
|
||||
<div ref={ref} className={`invisible ${className}`} {...props}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AnimatedContent;
|
||||
+11
-11
@@ -6,7 +6,7 @@ import Lanyard from "./Lanyard";
|
||||
import "./CardNav.css";
|
||||
|
||||
const CardNav = ({
|
||||
logo = "/images/logo.png",
|
||||
logo = "/images/logo.webp",
|
||||
logoAlt = "Esiah Logo",
|
||||
className = "",
|
||||
ease = "power3.out",
|
||||
@@ -62,44 +62,44 @@ const CardNav = ({
|
||||
if (location.pathname.startsWith("/projects")) {
|
||||
return [
|
||||
{
|
||||
image: "/images/Projects.png",
|
||||
image: "/images/Projects.webp",
|
||||
link: "/projects",
|
||||
title: "All my Projects",
|
||||
description: "To discover all my creations",
|
||||
},
|
||||
{
|
||||
image: "/images/NTR.png",
|
||||
image: "/images/NTR.webp",
|
||||
link: "/projects/neo-tokyo-rush",
|
||||
title: "Neo Tokyo Rush",
|
||||
description: "Cyberpunk-inspired beat 'em All game",
|
||||
},
|
||||
{
|
||||
image: "/images/PortfolioE1.png",
|
||||
image: "/images/PortfolioE1.webp",
|
||||
link: "https://portfolio-xesiahs-projects.vercel.app/",
|
||||
title: "Protfolio 2024",
|
||||
description: "Portfolio that gathers all my first year's projects",
|
||||
},
|
||||
{
|
||||
image: "/images/MC.png",
|
||||
image: "/images/Metz-Campus.webp",
|
||||
link: "_blank https://metzcampus.fr/",
|
||||
title: "Metz Campus",
|
||||
description:
|
||||
"Website crafted for the Metz Campus organization during my first-year internship.",
|
||||
},
|
||||
{
|
||||
image: "/images/Zatyshok.png",
|
||||
image: "/images/Zatyshok.webp",
|
||||
link: "/projects/zatyshok",
|
||||
title: "Затишок",
|
||||
description: "Moodboard application",
|
||||
},
|
||||
{
|
||||
image: "/images/SPRotD.png",
|
||||
image: "/images/SPRotD.webp",
|
||||
link: "/projects/shadow-purge-rite-of-the-demon",
|
||||
title: "Shadow Purge - Rite of the Demon",
|
||||
description: "Hack n'slash RPG",
|
||||
},
|
||||
{
|
||||
image: "/images/EotLS.png",
|
||||
image: "/images/EotLS.webp",
|
||||
link: "/projects/echoes-of-the-last-stop",
|
||||
title: "Echoes of the Last Stop",
|
||||
description: "Thriller game project in collaboration with my partner",
|
||||
@@ -108,19 +108,19 @@ const CardNav = ({
|
||||
}
|
||||
return [
|
||||
{
|
||||
image: "/images/Projects.png",
|
||||
image: "/images/Projects.webp",
|
||||
link: "/projects",
|
||||
title: "All my Projects",
|
||||
description: "To discover all my creations",
|
||||
},
|
||||
{
|
||||
image: "/images/Contact.jpg",
|
||||
image: "/images/Contact.webp",
|
||||
link: "/contact",
|
||||
title: "Contact",
|
||||
description: "Any requests? Feel free to reach out!",
|
||||
},
|
||||
{
|
||||
image: "/images/Cohaise.jpg",
|
||||
image: "/images/Cohaise.webp",
|
||||
link: "/cohaise",
|
||||
title: "Co Hai Se",
|
||||
description: "About us",
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
--text-dim: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
/* 1. CONFIGURATION LAYOUT & POINTER EVENTS */
|
||||
.menu-wrap {
|
||||
width: 100vw;
|
||||
margin-left: calc(-50vw + 50%); /* Full width hack */
|
||||
margin-left: calc(-50vw + 50%);
|
||||
margin-right: calc(-50vw + 50%);
|
||||
margin-top: 8rem;
|
||||
margin-bottom: 8rem;
|
||||
@@ -15,7 +14,6 @@
|
||||
position: relative;
|
||||
left: 0;
|
||||
will-change: height;
|
||||
/* CRUCIAL : La souris passe à travers pour atteindre le background (parallaxe) */
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@@ -25,7 +23,6 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0;
|
||||
/* CRUCIAL : La souris passe à travers */
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@@ -34,7 +31,6 @@
|
||||
overflow: hidden;
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
transition: background-color 0.4s ease;
|
||||
/* CRUCIAL : La souris passe à travers */
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@@ -42,7 +38,6 @@
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
/* 2. ÉLÉMENTS INTERACTIFS (On réactive la souris) */
|
||||
.menu__item-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -190,7 +185,7 @@
|
||||
width: 350px;
|
||||
height: 100px;
|
||||
margin: 0 3vw;
|
||||
border-radius: 4px;
|
||||
border-radius: 50px;
|
||||
filter: grayscale(100%) contrast(1.2);
|
||||
opacity: 0.8;
|
||||
background-size: cover;
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { useRef, useEffect, useState } from "react";
|
||||
import React, { useRef, useEffect, useState } from "react";
|
||||
import { gsap } from "gsap";
|
||||
import "./FlowingMenu.css";
|
||||
import { ScrollToPlugin } from "gsap/ScrollToPlugin";
|
||||
import "./FlowingMenu.css";
|
||||
|
||||
gsap.registerPlugin(ScrollToPlugin);
|
||||
|
||||
function FlowingMenu({
|
||||
// --- Définition des Types pour éviter l'erreur 'never[]' ---
|
||||
export interface FlowingMenuItem {
|
||||
text: string;
|
||||
image: string;
|
||||
Component?: React.ComponentType;
|
||||
}
|
||||
|
||||
interface FlowingMenuProps {
|
||||
items?: FlowingMenuItem[];
|
||||
speed?: number;
|
||||
textColor?: string;
|
||||
bgColor?: string;
|
||||
marqueeBgColor?: string;
|
||||
marqueeTextColor?: string;
|
||||
borderColor?: string;
|
||||
}
|
||||
|
||||
const FlowingMenu: React.FC<FlowingMenuProps> = ({
|
||||
items = [],
|
||||
speed = 15,
|
||||
textColor = "#fff",
|
||||
@@ -13,11 +31,11 @@ function FlowingMenu({
|
||||
marqueeBgColor = "rgba(0,0,0,0.8)",
|
||||
marqueeTextColor = "#fff",
|
||||
borderColor = "rgba(255,255,255,0.1)",
|
||||
}) {
|
||||
const [activeIdx, setActiveIdx] = useState(null);
|
||||
}) => {
|
||||
const [activeIdx, setActiveIdx] = useState<number | null>(null);
|
||||
const [isTransitioning, setIsTransitioning] = useState(false);
|
||||
|
||||
const toggleItem = (idx) => {
|
||||
const toggleItem = (idx: number) => {
|
||||
if (isTransitioning) return;
|
||||
if (activeIdx === idx) {
|
||||
setActiveIdx(null);
|
||||
@@ -51,20 +69,24 @@ function FlowingMenu({
|
||||
borderColor={borderColor}
|
||||
/>
|
||||
))}
|
||||
<div
|
||||
style={{
|
||||
height: "0px",
|
||||
transition: "height 0.5s ease",
|
||||
width: "100%",
|
||||
pointerEvents: "none",
|
||||
}}
|
||||
/>
|
||||
<div style={{ height: "0px", width: "100%", pointerEvents: "none" }} />
|
||||
</nav>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// --- Sous-composant MenuItem ---
|
||||
interface MenuItemProps extends FlowingMenuItem {
|
||||
speed: number;
|
||||
textColor: string;
|
||||
marqueeBgColor: string;
|
||||
marqueeTextColor: string;
|
||||
borderColor: string;
|
||||
isOpen: boolean;
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
function MenuItem({
|
||||
const MenuItem: React.FC<MenuItemProps> = ({
|
||||
text,
|
||||
image,
|
||||
speed,
|
||||
@@ -75,59 +97,65 @@ function MenuItem({
|
||||
isOpen,
|
||||
onClick,
|
||||
Component,
|
||||
}) {
|
||||
const itemRef = useRef(null);
|
||||
const marqueeRef = useRef(null);
|
||||
const marqueeInnerRef = useRef(null);
|
||||
const contentRef = useRef(null);
|
||||
}) => {
|
||||
const itemRef = useRef<HTMLDivElement>(null);
|
||||
const marqueeRef = useRef<HTMLDivElement>(null);
|
||||
const marqueeInnerRef = useRef<HTMLDivElement>(null);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const [repetitions, setRepetitions] = useState(2);
|
||||
// État local pour retarder le montage du composant Masonry le temps que l'animation commence
|
||||
const [shouldRenderContent, setShouldRenderContent] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
setShouldRenderContent(true);
|
||||
} else {
|
||||
// On attend la fin de l'animation de fermeture pour démonter
|
||||
const timer = setTimeout(() => setShouldRenderContent(false), 500);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
const calculateRepetitions = () => {
|
||||
if (!marqueeInnerRef.current) return;
|
||||
|
||||
const singlePart =
|
||||
marqueeInnerRef.current.querySelector(".marquee__part");
|
||||
const singlePart = marqueeInnerRef.current.querySelector(
|
||||
".marquee__part",
|
||||
) as HTMLElement;
|
||||
if (!singlePart) return;
|
||||
|
||||
const partWidth = singlePart.offsetWidth;
|
||||
const windowWidth = window.innerWidth;
|
||||
|
||||
if (partWidth > 0) {
|
||||
const needed = Math.ceil(windowWidth / partWidth) + 4;
|
||||
setRepetitions(needed);
|
||||
setRepetitions(Math.ceil(windowWidth / partWidth) + 4);
|
||||
}
|
||||
};
|
||||
|
||||
calculateRepetitions();
|
||||
window.addEventListener("resize", calculateRepetitions);
|
||||
return () => window.removeEventListener("resize", calculateRepetitions);
|
||||
}, [text]);
|
||||
|
||||
useEffect(() => {
|
||||
const marqueeContent =
|
||||
marqueeInnerRef.current?.querySelector(".marquee__part");
|
||||
if (!marqueeInnerRef.current) return;
|
||||
const marqueeContent = marqueeInnerRef.current.querySelector(
|
||||
".marquee__part",
|
||||
) as HTMLElement;
|
||||
if (!marqueeContent) return;
|
||||
|
||||
const contentWidth = marqueeContent.offsetWidth;
|
||||
if (contentWidth === 0) return;
|
||||
|
||||
const tl = gsap.to(marqueeInnerRef.current, {
|
||||
x: -contentWidth,
|
||||
duration: speed,
|
||||
ease: "none",
|
||||
repeat: -1,
|
||||
});
|
||||
|
||||
return () => tl.kill();
|
||||
return () => {
|
||||
tl.kill();
|
||||
};
|
||||
}, [speed, repetitions]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && itemRef.current) {
|
||||
const isMobile = window.innerWidth < 768;
|
||||
gsap.killTweensOf([contentRef.current, window, marqueeRef.current]);
|
||||
|
||||
gsap.to(contentRef.current, {
|
||||
height: "auto",
|
||||
opacity: 1,
|
||||
@@ -150,7 +178,6 @@ function MenuItem({
|
||||
ease: "power2.out",
|
||||
});
|
||||
} else {
|
||||
gsap.killTweensOf(contentRef.current);
|
||||
gsap.to(contentRef.current, {
|
||||
height: 0,
|
||||
opacity: 0,
|
||||
@@ -160,20 +187,6 @@ function MenuItem({
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
const handleMouseEnter = () => {
|
||||
if (window.matchMedia("(pointer: coarse)").matches) return;
|
||||
|
||||
if (isOpen) return;
|
||||
|
||||
gsap.to(marqueeRef.current, { y: "0%", duration: 0.6, ease: "expo" });
|
||||
gsap.set(marqueeInnerRef.current, { force3D: true });
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (window.matchMedia("(pointer: coarse)").matches) return;
|
||||
gsap.to(marqueeRef.current, { y: "101%", duration: 0.6, ease: "expo" });
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`menu__item ${isOpen ? "is-open" : ""}`}
|
||||
@@ -181,27 +194,41 @@ function MenuItem({
|
||||
style={{ borderColor }}
|
||||
>
|
||||
<div
|
||||
className={`menu__item-link ${isOpen ? "link-active" : ""}`}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
className="menu__item-link"
|
||||
onClick={onClick}
|
||||
onMouseEnter={() =>
|
||||
!isOpen &&
|
||||
gsap.to(marqueeRef.current, { y: "0%", duration: 0.6, ease: "expo" })
|
||||
}
|
||||
onMouseLeave={() =>
|
||||
gsap.to(marqueeRef.current, {
|
||||
y: "101%",
|
||||
duration: 0.6,
|
||||
ease: "expo",
|
||||
})
|
||||
}
|
||||
>
|
||||
{text}
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="service-details-wrapper"
|
||||
ref={contentRef}
|
||||
style={{ height: 0, overflow: "hidden", opacity: 0 }}
|
||||
>
|
||||
<div className="details-inner">{Component && <Component />}</div>
|
||||
<div className="details-inner px-4 py-8 md:px-12 md:py-12 w-full">
|
||||
{/* Rendu dynamique du Masonry : uniquement quand l'item est ouvert */}
|
||||
{shouldRenderContent && Component && <Component />}
|
||||
</div>
|
||||
</div>
|
||||
<div className="marquee" ref={marqueeRef}>
|
||||
|
||||
<div
|
||||
className="marquee"
|
||||
ref={marqueeRef}
|
||||
style={{ transform: "translate3d(0, 101%, 0)" }}
|
||||
>
|
||||
<div className="marquee__inner-wrap">
|
||||
<div
|
||||
className="marquee__inner"
|
||||
ref={marqueeInnerRef}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div className="marquee__inner" ref={marqueeInnerRef}>
|
||||
{[...Array(repetitions)].map((_, idx) => (
|
||||
<div
|
||||
className="marquee__part"
|
||||
@@ -220,6 +247,6 @@ function MenuItem({
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default FlowingMenu;
|
||||
@@ -0,0 +1,131 @@
|
||||
import { useEffect, useRef, FC } from "react";
|
||||
import { gsap } from "gsap";
|
||||
import SpotlightCard from "./SpotlightCard";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
export interface ProjectItem {
|
||||
id: string;
|
||||
img: string;
|
||||
link: string;
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
interface HorizontalMotionProps {
|
||||
items: ProjectItem[];
|
||||
gradientColor?: string;
|
||||
}
|
||||
|
||||
const HorizontalMotion: FC<HorizontalMotionProps> = ({
|
||||
items = [],
|
||||
gradientColor = "transparent",
|
||||
}) => {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const rowRefs = useRef<(HTMLDivElement | null)[]>([]);
|
||||
const mouseXRef = useRef<number>(window.innerWidth / 2);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleCardClick = (link: string) => {
|
||||
if (!link) return;
|
||||
const cleanLink = link.replace("_blank", "").trim();
|
||||
if (link.includes("_blank") || cleanLink.startsWith("http")) {
|
||||
window.open(cleanLink, "_blank", "noopener,noreferrer");
|
||||
} else {
|
||||
navigate(cleanLink);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
gsap.ticker.lagSmoothing(0);
|
||||
|
||||
const handleMouseMove = (e: MouseEvent): void => {
|
||||
mouseXRef.current = e.clientX;
|
||||
};
|
||||
|
||||
const updateMotion = (): void => {
|
||||
// Sur mobile, on désactive ou réduit fortement le mouvement pour éviter les bugs de scroll
|
||||
const isMobile = window.innerWidth < 768;
|
||||
const maxMoveAmount = isMobile ? 30 : 150;
|
||||
const baseDuration = 0.8;
|
||||
const inertiaFactors = [0.6, 0.4, 0.3, 0.2];
|
||||
|
||||
rowRefs.current.forEach((row, index) => {
|
||||
if (row) {
|
||||
const direction = index % 2 === 0 ? 1 : -1;
|
||||
const moveAmount =
|
||||
((mouseXRef.current / window.innerWidth) * maxMoveAmount -
|
||||
maxMoveAmount / 2) *
|
||||
direction;
|
||||
|
||||
gsap.to(row, {
|
||||
x: moveAmount,
|
||||
duration:
|
||||
baseDuration + inertiaFactors[index % inertiaFactors.length],
|
||||
ease: "power3.out",
|
||||
overwrite: "auto",
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const removeAnimationLoop = gsap.ticker.add(updateMotion);
|
||||
window.addEventListener("mousemove", handleMouseMove);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("mousemove", handleMouseMove);
|
||||
removeAnimationLoop();
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="relative w-full max-w-[100vw] overflow-hidden rounded-xl md:rounded-3xl bg-black/20"
|
||||
style={{
|
||||
background: `radial-gradient(circle, ${gradientColor} 0%, transparent 100%)`,
|
||||
}}
|
||||
>
|
||||
<section className="w-full flex flex-col justify-center">
|
||||
{items.map((item, index) => (
|
||||
<div
|
||||
key={item.id}
|
||||
className="relative w-[110%] md:w-[120%] -left-[5%] md:-left-[10%] h-40 md:h-62.5 lg:h-80 flex items-center justify-center p-1 md:p-2 will-change-transform"
|
||||
ref={(el) => {
|
||||
if (el) rowRefs.current[index] = el;
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="w-full h-full max-w-[100vw] md:max-w-350 cursor-pointer group px-2 md:px-0"
|
||||
onClick={() => handleCardClick(item.link)}
|
||||
>
|
||||
<SpotlightCard
|
||||
className="w-full h-full p-0! border border-white/5 rounded-xl md:rounded-3xl shadow-xl overflow-hidden"
|
||||
spotlightColor="rgba(255, 255, 255, 0.1)"
|
||||
>
|
||||
<div
|
||||
className="absolute inset-0 bg-cover bg-center transition-transform duration-1000 group-hover:scale-105"
|
||||
style={{ backgroundImage: `url(${item.img})` }}
|
||||
/>
|
||||
|
||||
<div className="cursor-target absolute inset-0 bg-linear-to-t md:bg-linear-to-r from-black/95 via-black/50 to-transparent opacity-90 group-hover:opacity-100 transition-opacity duration-500" />
|
||||
|
||||
<div className="pointer-events-none absolute inset-y-0 left-0 flex flex-col justify-end md:justify-center w-full md:w-2/3 p-4 md:p-12 z-10">
|
||||
<h3 className="cursor-target text-xl md:text-4xl lg:text-5xl font-bold text-white mb-1 md:mb-4 translate-y-2 md:group-hover:translate-y-0 transition-transform duration-500 ease-out drop-shadow-lg">
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className="cursor-target text-white/80 text-[10px] md:text-base lg:text-lg opacity-100 md:opacity-0 group-hover:opacity-100 transition-all duration-500 md:delay-75 max-w-xl line-clamp-2">
|
||||
{item.description}
|
||||
</p>
|
||||
</div>
|
||||
</SpotlightCard>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default HorizontalMotion;
|
||||
@@ -133,8 +133,8 @@ function Band({ isMobile }: BandProps) {
|
||||
const rot = new THREE.Vector3();
|
||||
|
||||
const { nodes, materials } = useGLTF("/3d/card.glb") as any;
|
||||
const texture = useTexture("/3d/lanyard.png");
|
||||
const badgeTexture = useTexture("/3d/badge_texture.png");
|
||||
const texture = useTexture("/3d/lanyard.webp");
|
||||
const badgeTexture = useTexture("/3d/badge_texture.webp");
|
||||
|
||||
const [curve] = useState(
|
||||
() =>
|
||||
|
||||
@@ -32,45 +32,45 @@ const DEFAULT_GLOW_COLOR = "183, 28, 28";
|
||||
const cardData: CardDataItem[] = [
|
||||
{
|
||||
title: "Metz Campus",
|
||||
image: "/images/MC.png",
|
||||
image: "/images/Metz-Campus.webp",
|
||||
description: "Web platform for students.",
|
||||
label: "Web site",
|
||||
label: "WordPress Web site",
|
||||
link: "https://metzcampus.fr",
|
||||
},
|
||||
{
|
||||
title: "Neo Tokyo Rush",
|
||||
image: "/images/NTR.png",
|
||||
description: "Cyberpunk beat 'em All.",
|
||||
label: "Gamedev",
|
||||
link: "/projects/neo-tokyo-rush",
|
||||
title: "Coeur UA PAM",
|
||||
image: "/images/Coeur-UA-PAM.webp",
|
||||
description: "Web site of the Coeur UA PAM association.",
|
||||
label: "React Web site",
|
||||
link: "https://coeur-ua-pam.fr/",
|
||||
},
|
||||
{
|
||||
title: "About Co Hai Se",
|
||||
image: "/images/Cohaise.jpg",
|
||||
image: "/images/Cohaise.webp",
|
||||
description: "Crafting the Web of Your Ambitions.",
|
||||
label: "Identity",
|
||||
link: "/cohaise",
|
||||
},
|
||||
{
|
||||
title: "Contact",
|
||||
image: "/images/Contact.jpg",
|
||||
description: "Reach out to me.",
|
||||
label: "Network",
|
||||
link: "/contact",
|
||||
title: "Projects",
|
||||
image: "/images/Projects.webp",
|
||||
description: "Discover who am i by my creations.",
|
||||
label: "Identity",
|
||||
link: "/projects",
|
||||
},
|
||||
{
|
||||
title: "Затишок",
|
||||
image: "/images/Zatyshok.png",
|
||||
description: "Moodboard developed with love.",
|
||||
image: "/images/Zatyshok.webp",
|
||||
description: "Moodboard developed with love !",
|
||||
label: "Desktop App",
|
||||
link: "/projects/zatyshok",
|
||||
},
|
||||
{
|
||||
title: "Shadow Purge",
|
||||
image: "/images/SPRotD.png",
|
||||
image: "/images/SPRotD.webp",
|
||||
description: "Hack n'slash RPG.",
|
||||
label: "Gamedev",
|
||||
link: "/projects/shadow-purge",
|
||||
link: "/projects/shadow-purge-rite-of-the-demon",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -255,7 +255,7 @@ export default function MagicBento({
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="w-full max-w-260 mx-auto p-4">
|
||||
<div className="w-full max-w-300 mx-auto p-4">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3">
|
||||
{cardData.map((card, i) => (
|
||||
<ParticleCard
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
|
||||
export default function ScrollToTop() {
|
||||
const { pathname } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, [pathname]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
import React, { useRef, useLayoutEffect, useState } from "react";
|
||||
import {
|
||||
motion,
|
||||
useScroll,
|
||||
useSpring,
|
||||
useTransform,
|
||||
useMotionValue,
|
||||
useVelocity,
|
||||
useAnimationFrame,
|
||||
} from "motion/react";
|
||||
|
||||
interface VelocityMapping {
|
||||
input: [number, number];
|
||||
output: [number, number];
|
||||
}
|
||||
|
||||
interface VelocityTextProps {
|
||||
children: React.ReactNode;
|
||||
baseVelocity: number;
|
||||
scrollContainerRef?: React.RefObject<HTMLElement>;
|
||||
className?: string;
|
||||
damping?: number;
|
||||
stiffness?: number;
|
||||
numCopies?: number;
|
||||
velocityMapping?: VelocityMapping;
|
||||
parallaxClassName?: string;
|
||||
scrollerClassName?: string;
|
||||
parallaxStyle?: React.CSSProperties;
|
||||
scrollerStyle?: React.CSSProperties;
|
||||
}
|
||||
|
||||
interface ScrollVelocityProps {
|
||||
scrollContainerRef?: React.RefObject<HTMLElement>;
|
||||
texts: string[];
|
||||
velocity?: number;
|
||||
className?: string;
|
||||
damping?: number;
|
||||
stiffness?: number;
|
||||
numCopies?: number;
|
||||
velocityMapping?: VelocityMapping;
|
||||
parallaxClassName?: string;
|
||||
scrollerClassName?: string;
|
||||
parallaxStyle?: React.CSSProperties;
|
||||
scrollerStyle?: React.CSSProperties;
|
||||
}
|
||||
|
||||
function useElementWidth<T extends HTMLElement>(
|
||||
ref: React.RefObject<T | null>,
|
||||
): number {
|
||||
const [width, setWidth] = useState(0);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
function updateWidth() {
|
||||
if (ref.current) {
|
||||
setWidth(ref.current.offsetWidth);
|
||||
}
|
||||
}
|
||||
updateWidth();
|
||||
window.addEventListener("resize", updateWidth);
|
||||
return () => window.removeEventListener("resize", updateWidth);
|
||||
}, [ref]);
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
export const ScrollVelocity: React.FC<ScrollVelocityProps> = ({
|
||||
scrollContainerRef,
|
||||
texts = [],
|
||||
velocity = 100,
|
||||
className = "",
|
||||
damping = 50,
|
||||
stiffness = 400,
|
||||
numCopies = 6,
|
||||
velocityMapping = { input: [0, 1000], output: [0, 5] },
|
||||
parallaxClassName,
|
||||
scrollerClassName,
|
||||
parallaxStyle,
|
||||
scrollerStyle,
|
||||
}) => {
|
||||
function VelocityText({
|
||||
children,
|
||||
baseVelocity = velocity,
|
||||
scrollContainerRef,
|
||||
className = "",
|
||||
damping,
|
||||
stiffness,
|
||||
numCopies,
|
||||
velocityMapping,
|
||||
parallaxClassName,
|
||||
scrollerClassName,
|
||||
parallaxStyle,
|
||||
scrollerStyle,
|
||||
}: VelocityTextProps) {
|
||||
const baseX = useMotionValue(0);
|
||||
const scrollOptions = scrollContainerRef
|
||||
? { container: scrollContainerRef }
|
||||
: {};
|
||||
const { scrollY } = useScroll(scrollOptions);
|
||||
const scrollVelocity = useVelocity(scrollY);
|
||||
const smoothVelocity = useSpring(scrollVelocity, {
|
||||
damping: damping ?? 50,
|
||||
stiffness: stiffness ?? 400,
|
||||
});
|
||||
const velocityFactor = useTransform(
|
||||
smoothVelocity,
|
||||
velocityMapping?.input || [0, 1000],
|
||||
velocityMapping?.output || [0, 5],
|
||||
{ clamp: false },
|
||||
);
|
||||
|
||||
const copyRef = useRef<HTMLSpanElement>(null);
|
||||
const copyWidth = useElementWidth(copyRef);
|
||||
|
||||
function wrap(min: number, max: number, v: number): number {
|
||||
const range = max - min;
|
||||
const mod = (((v - min) % range) + range) % range;
|
||||
return mod + min;
|
||||
}
|
||||
|
||||
const x = useTransform(baseX, (v) => {
|
||||
if (copyWidth === 0) return "0px";
|
||||
return `${wrap(-copyWidth, 0, v)}px`;
|
||||
});
|
||||
|
||||
const directionFactor = useRef<number>(1);
|
||||
useAnimationFrame((t, delta) => {
|
||||
let moveBy = directionFactor.current * baseVelocity * (delta / 1000);
|
||||
|
||||
if (velocityFactor.get() < 0) {
|
||||
directionFactor.current = -1;
|
||||
} else if (velocityFactor.get() > 0) {
|
||||
directionFactor.current = 1;
|
||||
}
|
||||
|
||||
moveBy += directionFactor.current * moveBy * velocityFactor.get();
|
||||
baseX.set(baseX.get() + moveBy);
|
||||
});
|
||||
|
||||
const spans = [];
|
||||
for (let i = 0; i < numCopies!; i++) {
|
||||
spans.push(
|
||||
<span
|
||||
className={`shrink-0 ${className}`}
|
||||
key={i}
|
||||
ref={i === 0 ? copyRef : null}
|
||||
>
|
||||
{children}
|
||||
</span>,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`${parallaxClassName} relative overflow-hidden`}
|
||||
style={parallaxStyle}
|
||||
>
|
||||
<motion.div
|
||||
className={`${scrollerClassName} flex whitespace-nowrap text-center font-sans text-4xl font-bold tracking-[-0.02em] drop-shadow md:text-[5rem] md:leading-20`}
|
||||
style={{ x, ...scrollerStyle }}
|
||||
>
|
||||
{spans}
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
{texts.map((text: string, index: number) => (
|
||||
<VelocityText
|
||||
key={index}
|
||||
className={className}
|
||||
baseVelocity={index % 2 !== 0 ? -velocity : velocity}
|
||||
scrollContainerRef={scrollContainerRef}
|
||||
damping={damping}
|
||||
stiffness={stiffness}
|
||||
numCopies={numCopies}
|
||||
velocityMapping={velocityMapping}
|
||||
parallaxClassName={parallaxClassName}
|
||||
scrollerClassName={scrollerClassName}
|
||||
parallaxStyle={parallaxStyle}
|
||||
scrollerStyle={scrollerStyle}
|
||||
>
|
||||
{text}
|
||||
</VelocityText>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default ScrollVelocity;
|
||||
@@ -0,0 +1,70 @@
|
||||
import React, { useRef, useState } from "react";
|
||||
|
||||
interface Position {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
interface SpotlightCardProps extends React.PropsWithChildren {
|
||||
className?: string;
|
||||
spotlightColor?: `rgba(${number}, ${number}, ${number}, ${number})`;
|
||||
}
|
||||
|
||||
const SpotlightCard: React.FC<SpotlightCardProps> = ({
|
||||
children,
|
||||
className = "",
|
||||
spotlightColor = "rgba(255, 255, 255, 0.15)", // Un peu plus subtil par défaut
|
||||
}) => {
|
||||
const divRef = useRef<HTMLDivElement>(null);
|
||||
const [isFocused, setIsFocused] = useState<boolean>(false);
|
||||
const [position, setPosition] = useState<Position>({ x: 0, y: 0 });
|
||||
const [opacity, setOpacity] = useState<number>(0);
|
||||
|
||||
const handleMouseMove: React.MouseEventHandler<HTMLDivElement> = (e) => {
|
||||
if (!divRef.current || isFocused) return;
|
||||
|
||||
const rect = divRef.current.getBoundingClientRect();
|
||||
setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
||||
};
|
||||
|
||||
const handleFocus = () => {
|
||||
setIsFocused(true);
|
||||
setOpacity(0.8);
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
setIsFocused(false);
|
||||
setOpacity(0);
|
||||
};
|
||||
|
||||
const handleMouseEnter = () => {
|
||||
setOpacity(0.8);
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
setOpacity(0);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={divRef}
|
||||
onMouseMove={handleMouseMove}
|
||||
onFocus={handleFocus}
|
||||
onBlur={handleBlur}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
className={`relative rounded-3xl border border-white/5 bg-black/40 backdrop-blur-md overflow-hidden p-8 transition-colors duration-500 hover:border-white/20 ${className}`}
|
||||
>
|
||||
<div
|
||||
className="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-700 ease-out"
|
||||
style={{
|
||||
opacity,
|
||||
background: `radial-gradient(600px circle at ${position.x}px ${position.y}px, ${spotlightColor}, transparent 100%)`,
|
||||
}}
|
||||
/>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SpotlightCard;
|
||||
@@ -0,0 +1,114 @@
|
||||
import React from "react";
|
||||
import HorizontalMotion from "../HorizontalMotion";
|
||||
|
||||
const gameDevItems = [
|
||||
{
|
||||
id: "1",
|
||||
img: "images/SPRotD.webp",
|
||||
link: "/projects/shadow-purge-rite-of-the-demon",
|
||||
title: "Shadow Purge : Rite of the Demon",
|
||||
description: "Hack n'slash RPG made with Unity & Aseprite.",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
img: "images/EotLS.webp",
|
||||
link: "/projects/echoes-of-the-last-stop",
|
||||
title: "Echoes of the Last Stop",
|
||||
description:
|
||||
"Story-driven thriller game with branching narratives in collaboration with my partner made with Unity & Aseprite.",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
img: "images/NTR-Menu.webp",
|
||||
link: "/projects/neo-tokyo-rush",
|
||||
title: "Neo Tokyo Rush",
|
||||
description:
|
||||
"Cyberpunk-inspired beat 'em All game made with Unity & Aseprite.",
|
||||
},
|
||||
];
|
||||
|
||||
const reactWebItems = [
|
||||
{
|
||||
id: "101",
|
||||
img: "images/Cohaise.webp",
|
||||
link: "/cohaise",
|
||||
title: "Co Hai Se",
|
||||
description: "Landing single page for my (fictionnal) compagny.",
|
||||
},
|
||||
{
|
||||
id: "102",
|
||||
img: "images/Esiah-s-Universe.webp",
|
||||
link: "/",
|
||||
title: "Esiah's Universe",
|
||||
description: "A journey through code, design, and imagination.",
|
||||
},
|
||||
{
|
||||
id: "103",
|
||||
img: "images/Coeur-UA-PAM.webp",
|
||||
link: "https://coeur-ua-pam.fr/",
|
||||
title: "Coeur UA PAM",
|
||||
description: "Web site for Coeur UA PAM association.",
|
||||
},
|
||||
];
|
||||
|
||||
const wordpressItems = [
|
||||
{
|
||||
id: "201",
|
||||
img: "images/Metz-Campus.webp",
|
||||
link: "https://metzcampus.fr/",
|
||||
title: "Metz Campus",
|
||||
description:
|
||||
"Website made during my 1st year internship for Metz Campus organisation.",
|
||||
},
|
||||
];
|
||||
|
||||
const desktopAppItems = [
|
||||
{
|
||||
id: "301",
|
||||
img: "images/Zatyshok.webp",
|
||||
link: "/projects/zatyshok",
|
||||
title: "Затишок",
|
||||
description: "Moodboard application created for my partner !",
|
||||
},
|
||||
];
|
||||
|
||||
const angulartWebItems = [
|
||||
{
|
||||
id: "401",
|
||||
img: "images/WYG-TIWIF.webp",
|
||||
link: "/projects/wyg-tiwif",
|
||||
title: "WYG-TIWIF",
|
||||
description:
|
||||
"Your social travel hub. A Full Stack (MEAN) application to build your travel wishlist and follow other users' journeys.",
|
||||
},
|
||||
];
|
||||
|
||||
export const GameDevGallery = () => (
|
||||
<div className="w-full mt-8">
|
||||
<HorizontalMotion items={gameDevItems} />
|
||||
</div>
|
||||
);
|
||||
|
||||
export const ReactWebGallery = () => (
|
||||
<div className="w-full mt-8">
|
||||
<HorizontalMotion items={reactWebItems} />
|
||||
</div>
|
||||
);
|
||||
|
||||
export const WordpressGallery = () => (
|
||||
<div className="w-full mt-8">
|
||||
<HorizontalMotion items={wordpressItems} />
|
||||
</div>
|
||||
);
|
||||
|
||||
export const DesktopAppGallery = () => (
|
||||
<div className="w-full mt-8">
|
||||
<HorizontalMotion items={desktopAppItems} />
|
||||
</div>
|
||||
);
|
||||
|
||||
export const AngulartWebGallery = () => (
|
||||
<div className="w-full mt-8">
|
||||
<HorizontalMotion items={angulartWebItems} />
|
||||
</div>
|
||||
);
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from "react";
|
||||
|
||||
// Un sous-composant pour éviter de répéter le style des tags/li
|
||||
const ServiceTag = ({ children }: { children: React.ReactNode }) => (
|
||||
<li className="px-6 py-2.5 border border-white/15 rounded-full text-[0.9rem] uppercase tracking-wider text-white bg-transparent transition-all duration-300 hover:bg-white hover:text-black hover:border-white cursor-default">
|
||||
{children}
|
||||
Reference in New Issue
Block a user