From e14192d2a8964d95d8cdd0c359bb7e25cddcdada Mon Sep 17 00:00:00 2001 From: vshnosngh Date: Tue, 3 Nov 2026 15:46:35 +0530 Subject: [PATCH] feat(ui): restore inverted optical liquid glass reflection with cylindrical lens distortion and 120 FPS performance --- src/app/globals.css | 43 ++++++++++++------ src/components/ui/Navbar.tsx | 70 +++++++++++++++--------------- src/components/ui/SmoothScroll.tsx | 5 ++- 3 files changed, 68 insertions(+), 50 deletions(-) diff --git a/src/app/globals.css b/src/app/globals.css index d7657ad..abfda0a 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -136,25 +136,42 @@ overflow: hidden; pointer-events: none; z-index: 1; - opacity: 0.6; - filter: url("#glass-liquid-warp"); + /* Physical Optical Inversion & 3D Cylindrical Lens Curvature */ + transform: perspective(400px) rotateX(6deg) scaleY(-1.06) scaleX(1.02); + transform-origin: center center; + opacity: 0.58; mix-blend-mode: luminosity; - transform: translateZ(0); + filter: blur(0.35px) contrast(124%) saturate(220%) brightness(1.06); + contain: strict; + will-change: transform; } -.liquid-fluid-wave { +.liquid-refraction-mirror { position: absolute; - top: -120px; - left: -25%; - width: 150%; - height: 600px; + top: 0; + left: 0; + width: 100vw; + pointer-events: none; + will-change: transform; +} + +/* Prismatic Liquid Caustic Refraction Overlay */ +.liquid-caustic-refraction { + position: absolute; + inset: 0; pointer-events: none; background: - radial-gradient(ellipse 65% 35% at 25% 30%, rgba(56, 189, 248, 0.35) 0%, transparent 60%), - radial-gradient(ellipse 70% 45% at 75% 70%, rgba(124, 58, 237, 0.32) 0%, transparent 65%), - radial-gradient(ellipse 85% 55% at 50% 50%, rgba(37, 99, 235, 0.25) 0%, transparent 70%); - will-change: transform; - transform: translateZ(0) scaleY(-1); + linear-gradient( + 180deg, + rgba(255, 255, 255, 0.22) 0%, + transparent 25%, + transparent 75%, + rgba(255, 255, 255, 0.14) 100% + ), + radial-gradient(ellipse 65% 50% at 25% 35%, rgba(56, 189, 248, 0.16) 0%, transparent 60%), + radial-gradient(ellipse 70% 50% at 75% 65%, rgba(168, 85, 247, 0.14) 0%, transparent 60%); + mix-blend-mode: overlay; + z-index: 2; } /* Liquid Glass Mobile Dropdown */ diff --git a/src/components/ui/Navbar.tsx b/src/components/ui/Navbar.tsx index 4f7b941..0273733 100644 --- a/src/components/ui/Navbar.tsx +++ b/src/components/ui/Navbar.tsx @@ -28,42 +28,64 @@ export function Navbar({ config, currentLocale }: NavbarProps) { return () => window.removeEventListener('scroll', handleScroll); }, []); - // Ultra-Fast Hardware-Accelerated Optical Liquid Refraction Wave (120 FPS on Mobile & Desktop) + // Optical Inverted Liquid Glass Refraction Pipeline (120 FPS on all devices) useEffect(() => { let rafId: number; - const updateWave = () => { - if (!mirrorRef.current) return; + const updateMirror = () => { + if (!mirrorRef.current || !navRef.current) return; + const navRect = navRef.current.getBoundingClientRect(); const lenis = (window as any).lenis; const scrollY = lenis && typeof lenis.scroll === 'number' ? lenis.scroll : window.scrollY; - // Invert on Y (scaleY(-1)) and translate in opposite optical direction on scroll - const offset = (scrollY * 0.45) % 400; - mirrorRef.current.style.transform = `translate3d(0, -${offset}px, 0) scaleY(-1)`; + + mirrorRef.current.style.left = `-${navRect.left}px`; + mirrorRef.current.style.transform = `translate3d(0, -${scrollY + navRect.top}px, 0)`; }; + // Populate inverted reflection mirror with a lightweight visual clone of
+ const setupMirror = () => { + const mainEl = document.querySelector('main'); + if (mainEl && mirrorRef.current) { + mirrorRef.current.innerHTML = ''; + const clone = mainEl.cloneNode(true) as HTMLElement; + // Strip heavy non-visual, interactive, and duplicated elements + clone.querySelectorAll('[id]').forEach((el) => el.removeAttribute('id')); + clone.querySelectorAll('canvas, script, noscript, iframe, video, audio').forEach((el) => el.remove()); + clone.querySelectorAll('a, button, input, select, textarea').forEach((el) => { + el.setAttribute('tabindex', '-1'); + (el as HTMLElement).style.pointerEvents = 'none'; + }); + mirrorRef.current.appendChild(clone); + updateMirror(); + } + }; + + // Allow DOM to settle on mount or route transition + const timer = setTimeout(setupMirror, 60); + const onScroll = () => { cancelAnimationFrame(rafId); - rafId = requestAnimationFrame(updateWave); + rafId = requestAnimationFrame(updateMirror); }; const lenis = (window as any).lenis; if (lenis && typeof lenis.on === 'function') { - lenis.on('scroll', updateWave); + lenis.on('scroll', updateMirror); } window.addEventListener('scroll', onScroll, { passive: true }); window.addEventListener('resize', onScroll, { passive: true }); - updateWave(); return () => { + clearTimeout(timer); if (lenis && typeof lenis.off === 'function') { - lenis.off('scroll', updateWave); + lenis.off('scroll', updateMirror); } window.removeEventListener('scroll', onScroll); window.removeEventListener('resize', onScroll); cancelAnimationFrame(rafId); }; - }, []); + }, [pathname]); const handleMouseMove = (e: React.MouseEvent) => { const rect = e.currentTarget.getBoundingClientRect(); @@ -78,29 +100,6 @@ export function Navbar({ config, currentLocale }: NavbarProps) { return (
- {/* SVG Optical Liquid Glass Refraction & Distortion Filter (Single Octave Ultra-Fast GPU Shader) */} - -
{/* Optical Inverted Liquid Glass Refraction Chamber */}