diff --git a/AGENTS.md b/AGENTS.md index c95e6d8..61b8beb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -78,7 +78,7 @@ src/ components/ layout/ — Layout.tsx, Navigation.tsx, MobileMenu.tsx, Footer.tsx, ThemePaletteMenu.tsx sections/ — Hero, About, Expertise, Experience, Projects, Contact, HeroParticles, DownloadResume - ui/ — Badge, Button, SectionHeading, SocialLinks, Tag, Typewriter, AnimatedSection, InView, RollingTextLink, BackToTop + ui/ — Badge, Button, SectionHeading, SocialLinks, Tag, Typewriter, InView, RollingTextLink, BackToTop index.ts — barrel export data/ — profile, skills, experience, projects, resume, palettes, navigation, social (TS modules) hooks/ — useTheme.tsx, useLanguage.tsx, useClickOutside.ts @@ -89,7 +89,9 @@ src/ ## Motion & Animation - `motion/react` v14 — ESM-first entrypoint (NOT `framer-motion`) -- `AnimatedSection.tsx` — scroll-triggered motion animation wrapper +- Section entrance recipe — every section (`Hero`, `About`, `Expertise`, `Experience`, `Projects`, `Contact`) and every standalone page: `InView` wrapping a `motion.section` with `initial="hidden" whileInView="visible"`, `viewport={{ once: true, amount: 0.1 }}` and `variants` `hidden: { opacity: 0 }` / `visible: { opacity: 1, transition: { duration: 0.5 } }` +- Item recipe (timeline entries, philosophy/expertise/project cards, hero content blocks, contact links, project-detail blocks): `motion.*` with `initial={{ opacity: 0, y: 24 }}`, `whileInView={{ opacity: 1, y: 0 }}`, `viewport={{ once: true, amount: 0.2 }}`, `transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}` +- Hover/press recipe — motion owns the transform, CSS `:hover` only colour/border/shadow: cards and links (`.project-card`, `.expertise-card`, `.philosophy-card`, `.contact-link`) use `whileHover={{ scale: 1.02, y: -4 }}` + `whileTap={{ scale: 0.98 }}`; `Button` uses `whileHover={{ y: -2 }}` + `whileTap={{ scale: 0.95 }}`; `.social-link` tiles use `scale: 1.1` / `0.9`. A motion-animated element never carries a CSS `transform` or `transition: all` - `InView.tsx` — viewport intersection observer motion component - `RollingTextLink.tsx` — animated text-scrolling navigation link - `BackToTop.tsx` — scroll-to-top floating button with AnimatePresence diff --git a/docs/design/specs/v3/spec-v3-mobile-navigation.md b/docs/design/specs/v3/spec-v3-mobile-navigation.md index 5c33a21..0b47c41 100644 --- a/docs/design/specs/v3/spec-v3-mobile-navigation.md +++ b/docs/design/specs/v3/spec-v3-mobile-navigation.md @@ -183,7 +183,7 @@ Per the owner's answer, the sheet reuses the footer's icon-only 48×48 tiles (`s | Effect | Implementation | Cost / risk | |---|---|---| -| Sheet enter **and** exit | `AnimatePresence` + `motion.div`, `opacity 0→1`, `y -12→0`, 220ms, `ease [0.25, 0.1, 0.25, 1]` (the curve already used in `AnimatedSection.tsx:31`) | Replaces `@keyframes slideIn` (`src/App.css:143-152`), deleted. Conditional mount also fixes D4 | +| Sheet enter **and** exit | `AnimatePresence` + `motion.div`, `opacity 0→1`, `y -12→0`, 220ms, `ease [0.25, 0.1, 0.25, 1]` (declared inline at `MobileMenu.tsx:38`) | Replaces `@keyframes slideIn` (`src/App.css:143-152`), deleted. Conditional mount also fixes D4 | | Staggered rows | each nav row is a `motion.li` with `opacity 0→1`, `y 8→0`, `delay 0.05 + index * 0.04` | 6 rows finish at 0.33s. `motion.config.reducedMotion = 'user'` (`main.tsx:9`) strips transforms for reduce-users; `useReducedMotion()` zeroes the delays | | Group blocks | the Appearance and Connect groups fade with the panel, no separate stagger | Deliberate: staggering 3 groups too would push the total reveal past 0.5s | | Row press feedback | CSS only: `:hover` / `:active` → `background: var(--bg-elevated)` | No JS, no per-row motion cost | diff --git a/docs/design/specs/v3/spec-v3-ui-enhancements.md b/docs/design/specs/v3/spec-v3-ui-enhancements.md index 0335925..2f4359d 100644 --- a/docs/design/specs/v3/spec-v3-ui-enhancements.md +++ b/docs/design/specs/v3/spec-v3-ui-enhancements.md @@ -25,12 +25,17 @@ Enhance the portfolio UI with visual effects inspired by modern developer portfo | 6 | Hero: floating particles | ✅ Done | `HeroParticles.tsx`, `Hero.tsx`, `App.css` | | 7 | Hero: scroll indicator | ✅ Done | `Hero.tsx`, `App.css` | | 8 | Button: gradient + outline + icon slide | ✅ Done | `Button.tsx`, `App.css` | -| 9 | Scroll animations: AnimatedSection | ✅ Done | `AnimatedSection.tsx`, `AboutPage.tsx` | +| 9 | Scroll animations: section + item entrance recipe | ✅ Done | `Hero.tsx`, `About.tsx`, `AboutPage.tsx`, `Experience.tsx`, `Expertise.tsx`, `Projects.tsx`, `Contact.tsx` | | 10 | Logo: bracket format | ✅ Done | `Navigation.tsx`, `App.css` | | 11 | Build + verify | ✅ Done | type-check + lint pass (build locked by dev server) | | 12 | Download resume: click outside to close | ✅ Done | `DownloadResume.tsx`, `Hero.tsx`, `App.css`, `hooks/useClickOutside.ts` | | 13 | Download resume: FontAwesome-style icon | ✅ Done | `DownloadResume.tsx`, `Hero.tsx` | | 14 | Mobile: hero section responsive fixes | ✅ Done | `App.css` | +| 15 | Hero particles: reduced-motion fallback (iPadOS) | ✅ Done | `App.css` | +| 16 | Hero particles: 3D depth tiers + scroll parallax | ✅ Done | `HeroParticles.tsx`, `App.css` | +| 17 | Animation consistency: hero + about match the Experience recipe | ✅ Done | `Hero.tsx`, `About.tsx`, `AboutPage.tsx`, `AnimatedSection.tsx` (deleted) | +| 18 | Animation consistency: every page and section on the same recipe | ✅ Done | `Expertise.tsx`, `Projects.tsx`, `Contact.tsx`, `ExperiencePage.tsx`, `ProjectsListPage.tsx`, `ProjectDetailPage.tsx`, `PhilosophyPage.tsx`, `ContactPage.tsx` | +| 19 | Hover + press feedback unified (motion owns the transform) | ✅ Done | `Button.tsx`, `Expertise.tsx`, `Contact.tsx`, `About.tsx`, `AboutPage.tsx`, `Projects.tsx`, `ProjectsListPage.tsx`, `ContactPage.tsx`, `App.css` | --- ## Prerequisites (Type/Data Changes) @@ -232,79 +237,111 @@ interface TypewriterProps { ### 1.4 Floating Particles -**Effect:** Small dots floating upward in the hero background (30 desktop, 15 mobile). +**Effect:** Dots rising through a perspective-projected depth field — three tiers (far / mid / near), 30 dots desktop, 15 mobile. **Implementation:** -- New component: `src/components/sections/HeroParticles.tsx` -- Creates `div.hero-particle` elements via `useMemo` (stable, no re-renders) -- Each particle has random: `left` position, `animationDuration` (8–18s), `animationDelay` (0–10s), `width` (2–5px) -- Animation: `float-particle` keyframes (translateY 100vh → -100px, scale 0 → 1) -- Color: `var(--accent)` +- Three `DepthTier` records (`FAR`, `MID`, `NEAR`) hold every per-tier constant; the component renders one `motion.div.hero-particle-layer--` per tier +- Each tier declares its own `perspective: 700px`, so its dots are direct children of a perspective-declaring element and get genuine projection — `transform-style: preserve-3d` is used nowhere +- `translateZ` runs from deep towards the viewer, so a dot grows *and* fans out away from the vanishing point (`perspective-origin: 50% 78%`); hand-applied `scale()` cannot produce that lateral fan, which is why the old flat version read as "dots sliding up" rather than "dots floating in space" +- `--p-from` / `--p-to` are raw translateY offsets tuned per tier so that after projection every tier crosses the full hero box; equal projected distance with a longer `animation-duration` is what makes the far tier read as slower +- `--p-drift` sweeps each dot sideways across the cycle (opposite sign at 0% and 100%), so no path is a straight vertical line +- `animation-delay` is negative: every cycle is already in progress at mount, so the hero is populated at once instead of filling in over 10s +- Scroll parallax: three `useTransform(scrollY, [0, 500], [0, -30 | -60 | -100])`, one per layer — the near tier moves fastest +- Depth cue for the closest tier is `box-shadow: 0 0 10px var(--accent-glow)`. No `filter: blur()` and no `mask-image` on the container: both pull the animated dots into one re-rasterized group every frame, which is the main takedown risk on iPad +- Color `var(--accent)`; per-dot opacity jitter 0.75–1.10 × the tier opacity. Dot count stays 30 / 15 — the 3D pass adds a transform axis, not more elements + +| Tier | `translateZ` | Projected scale | Size | Opacity | Duration | Drift | Desktop / Mobile | +|---|---|---|---|---|---|---|---| +| far | -500 → -180px | 0.58x → 0.80x | 6–9px → 3.5–7.2px projected | 0.22 | 16–24s | ±14px | 12 / 6 | +| mid | -300 → -60px | 0.70x → 0.92x | 7–11px → 4.9–10.1px projected | 0.45 | 11–17s | ±26px | 12 / 6 | +| near | -120 → +120px | 0.85x → 1.21x | 7–12px → 6.0–14.5px projected | 0.80 | 7–11s | ±40px | 6 / 3 | **CSS:** ```css -.hero-particles { +.hero-particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; } + +/* perspective lives on the layer: overflow: hidden on .hero-particles forces its used + transform-style to flat, so a perspective declared there projects only the three + layers and never the dots. */ +.hero-particle-layer { position: absolute; inset: 0; - overflow: hidden; - pointer-events: none; + perspective: 700px; + perspective-origin: 50% 78%; } .hero-particle { position: absolute; - width: 4px; - height: 4px; background: var(--accent); border-radius: 50%; - opacity: 0.3; + opacity: 0; animation: float-particle linear infinite; } +.hero-particle-layer--near .hero-particle { box-shadow: 0 0 10px var(--accent-glow); } + @keyframes float-particle { - 0% { transform: translateY(100vh) scale(0); opacity: 0; } - 10% { opacity: 0.3; } - 90% { opacity: 0.3; } - 100% { transform: translateY(-100px) scale(1); opacity: 0; } + 0% { transform: translate3d(var(--p-drift), var(--p-from), var(--p-z0)); opacity: 0; } + 12% { opacity: var(--p-op); } + 88% { opacity: var(--p-op); } + 100% { transform: translate3d(calc(var(--p-drift) * -1), var(--p-to), var(--p-z1)); opacity: 0; } } ``` +**Reduced motion (iPadOS / Safari):** + +`.hero-particle` declares `animation: float-particle linear infinite`, so `animation-fill-mode` is `none`. The global reduced-motion rule in `src/index.css` clamps `animation-duration` to `0.01ms` with `animation-iteration-count: 1`, which ends the animation instantly and returns each dot to its unanimated style: `opacity` restored, no transform, `top: auto` — the static position at the top edge of `.hero-particles`. All dots then stack inside the hero's first 16px, behind `.nav` (`position: fixed; top: 0; z-index: 1000`), so the layer reads as missing. iPadOS exposes this as Settings → Accessibility → Motion → Reduce Motion, which Safari reports as `prefers-reduced-motion: reduce`. + +Fix: hide the decorative layer instead of freezing it, in the existing reduced-motion block of `src/App.css` (same convention as `.download-resume-lazer-border`): + +```css +@media (prefers-reduced-motion: reduce) { + .hero-particles { + display: none; + } +} +``` + +Not a viewport problem: no media query hides `.hero-particles`, and `window.innerWidth < 768` only picks 15 vs 30 dots — iPad Pro (834 / 1024 / 1210 / 1366) always takes 30. + **HeroParticles.tsx:** ```tsx +const FAR: DepthTier = { z: [-500, -180], from: 121, to: -29, size: [6, 9], opacity: 0.22, duration: [16, 24], drift: 14, counts: { desktop: 12, mobile: 6 }, scrollShift: -30 } +const MID: DepthTier = { z: [-300, -60], from: 114, to: -14, size: [7, 11], opacity: 0.45, duration: [11, 17], drift: 26, counts: { desktop: 12, mobile: 6 }, scrollShift: -60 } +const NEAR: DepthTier = { z: [-120, 120], from: 103, to: 17, size: [7, 12], opacity: 0.8, duration: [7, 11], drift: 40, counts: { desktop: 6, mobile: 3 }, scrollShift: -100 } + export function HeroParticles() { - const count = typeof window !== 'undefined' && window.innerWidth < 768 ? 15 : 30 - const particles = useMemo(() => - Array.from({ length: count }, (_, i) => ({ - id: i, - left: `${Math.random() * 100}%`, - duration: `${Math.random() * 10 + 8}s`, - delay: `${Math.random() * 10}s`, - size: `${Math.random() * 3 + 2}px`, - })), - [count] + const isMobile = typeof window !== 'undefined' && window.innerWidth < 768 + const { scrollY } = useScroll() + const layerY = { + far: useTransform(scrollY, SCROLL_RANGE, [0, FAR.scrollShift]), + mid: useTransform(scrollY, SCROLL_RANGE, [0, MID.scrollShift]), + near: useTransform(scrollY, SCROLL_RANGE, [0, NEAR.scrollShift]), + } + const layers = useMemo( + () => depthTiers.map(tier => ({ tier, particles: createParticles(tier, isMobile ? tier.counts.mobile : tier.counts.desktop) })), + [isMobile], ) return (