# Specification - v3 UI Enhancements firstName: "Dong", lastName: "Nguyen", name: "Dong Nguyen", > **Parent:** `spec-v2-homepage-enhancements.md` > **Status:** Draft — not yet implemented --- ## Overview Enhance the portfolio UI with visual effects inspired by modern developer portfolios. All features use existing dependencies (`motion`/`framer-motion`, CSS) — no new packages required. ## Implementation Progress | # | Feature | Status | File(s) | |---|---------|--------|---------| | 0 | Prerequisites: types + data | ✅ Done | `types/index.ts`, `data/profile.ts`, `SectionHeading.tsx`, `App.css` | | 1 | Section headers (numbered tags) | ✅ Done | `SectionHeading.tsx`, `App.css`, pages/sections | | 2 | Hero: greeting + animated dot | ✅ Done | `Hero.tsx`, `App.css` | | 3 | Hero: gradient name highlight | ✅ Done | `Hero.tsx`, `App.css` | | 4 | Hero: background grid | ✅ Done | `Hero.tsx`, `App.css` | | 5 | Hero: typewriter effect | ✅ Done | `Typewriter.tsx`, `Hero.tsx`, `App.css` | | 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: 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) Before implementing UI features, update types and data modules: ### 1. Profile Type — Add `firstName`, `lastName`, `roles` **File:** `src/types/index.ts` ```ts export interface Profile { name: string firstName: string // NEW lastName: string // NEW title: string titleEn?: string tagline: string taglineEn?: string bio: string bioEn?: string email: string githubUrl: string linkedinUrl: string resumeUrl?: string currentInterests: string[] philosophy: PhilosophyPoint[] } ``` ### 2. Profile Data — Fill `firstName`, `lastName`, `roles` **File:** `src/data/profile.ts` ```ts export const profile: Profile = { name: "Dong Nguyen", firstName: "Dong", // NEW lastName: "Nguyen", // NEW title: "Senior Software Engineer", // ... existing fields unchanged roles: [ // NEW "Full-Stack Developer", "System Architect", "AI/ML Engineer", ], } export interface Profile { name: string; firstName: string; lastName: string; title: string; titleEn?: string; tagline: string; taglineEn?: string; bio: string; bioEn?: string; email: string; githubUrl: string; linkedinUrl: string; resumeUrl?: string; currentInterests: string[]; roles: string[]; philosophy: PhilosophyPoint[]; } --- ## 1. Hero Section Enhancements ### 1.1 Typewriter Effect **Effect:** Role titles cycle with typewriter animation (type → pause → delete → next). **Implementation:** - New component: `src/components/ui/Typewriter.tsx` - Uses `useState` + `useEffect` for character cycling - Cursor blink via CSS `@keyframes` - Configurable from `profile.roles` **Props:** ```tsx interface TypewriterProps { texts: string[] typeSpeed?: number // ms per character (default 80) deleteSpeed?: number // ms per character (default 40) pauseDuration?: number // ms pause at end (default 2000) } ``` **CSS — cursor blink:** ```css .typewriter-cursor { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); margin-left: 2px; vertical-align: text-bottom; animation: blink 1s step-end infinite; } @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } } ``` **Files:** - `src/components/ui/Typewriter.tsx` (new) - `src/data/profile.ts` (add `roles`) - `src/types/index.ts` (add `roles` to `Profile`) - `src/index.css` (cursor blink animation) --- ### 1.2 Greeting with Animated Dot **Effect:** "Hi, I'm" with a pulsing green dot before the name. **Implementation:** - Add `` before hero name - Green dot: `width: 10px; height: 10px; background: var(--success); border-radius: 50%;` - Pulse animation: `box-shadow` expands from 0 to 8px and fades **CSS:** ```css .hero-greeting { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 1.1rem; color: var(--text-secondary); } .greeting-dot { width: 10px; height: 10px; background: var(--success); border-radius: 50%; animation: pulse-dot 2s ease-in-out infinite; } @keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } } ``` **Hero.tsx JSX:** ```tsx Hi, I'm ``` **Files:** - `src/components/sections/Hero.tsx` - `src/index.css` --- ### 1.3 Background Grid Pattern **Effect:** Subtle grid overlay on hero background, faded at edges via radial mask. **Implementation:** - Add `
` as first child of hero section (after `InView`) - CSS grid pattern with `linear-gradient`, 60px spacing - Mask: `radial-gradient(ellipse at center, black 30%, transparent 70%)` - Color: `rgba(96, 165, 250, 0.03)` (uses `--accent`) **CSS:** ```css .hero-bg-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(96, 165, 250, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(96, 165, 250, 0.03) 1px, transparent 1px); background-size: 60px 60px; mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%); pointer-events: none; } ``` **Files:** - `src/components/sections/Hero.tsx` - `src/App.css` --- ### 1.4 Floating Particles **Effect:** Dots rising through a perspective-projected depth field — three tiers (far / mid / near), 30 dots desktop, 15 mobile. **Implementation:** - 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 { 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; perspective: 700px; perspective-origin: 50% 78%; } .hero-particle { position: absolute; background: var(--accent); border-radius: 50%; 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: 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 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 (