feat(ui): restore inverted optical liquid glass reflection with cylindrical lens distortion and 120 FPS performance
This commit is contained in:
+30
-13
@@ -136,25 +136,42 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
opacity: 0.6;
|
/* Physical Optical Inversion & 3D Cylindrical Lens Curvature */
|
||||||
filter: url("#glass-liquid-warp");
|
transform: perspective(400px) rotateX(6deg) scaleY(-1.06) scaleX(1.02);
|
||||||
|
transform-origin: center center;
|
||||||
|
opacity: 0.58;
|
||||||
mix-blend-mode: luminosity;
|
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;
|
position: absolute;
|
||||||
top: -120px;
|
top: 0;
|
||||||
left: -25%;
|
left: 0;
|
||||||
width: 150%;
|
width: 100vw;
|
||||||
height: 600px;
|
pointer-events: none;
|
||||||
|
will-change: transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Prismatic Liquid Caustic Refraction Overlay */
|
||||||
|
.liquid-caustic-refraction {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
background:
|
background:
|
||||||
radial-gradient(ellipse 65% 35% at 25% 30%, rgba(56, 189, 248, 0.35) 0%, transparent 60%),
|
linear-gradient(
|
||||||
radial-gradient(ellipse 70% 45% at 75% 70%, rgba(124, 58, 237, 0.32) 0%, transparent 65%),
|
180deg,
|
||||||
radial-gradient(ellipse 85% 55% at 50% 50%, rgba(37, 99, 235, 0.25) 0%, transparent 70%);
|
rgba(255, 255, 255, 0.22) 0%,
|
||||||
will-change: transform;
|
transparent 25%,
|
||||||
transform: translateZ(0) scaleY(-1);
|
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 */
|
/* Liquid Glass Mobile Dropdown */
|
||||||
|
|||||||
@@ -28,42 +28,64 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
|
|||||||
return () => window.removeEventListener('scroll', handleScroll);
|
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(() => {
|
useEffect(() => {
|
||||||
let rafId: number;
|
let rafId: number;
|
||||||
|
|
||||||
const updateWave = () => {
|
const updateMirror = () => {
|
||||||
if (!mirrorRef.current) return;
|
if (!mirrorRef.current || !navRef.current) return;
|
||||||
|
const navRect = navRef.current.getBoundingClientRect();
|
||||||
const lenis = (window as any).lenis;
|
const lenis = (window as any).lenis;
|
||||||
const scrollY = lenis && typeof lenis.scroll === 'number' ? lenis.scroll : window.scrollY;
|
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.left = `-${navRect.left}px`;
|
||||||
mirrorRef.current.style.transform = `translate3d(0, -${offset}px, 0) scaleY(-1)`;
|
mirrorRef.current.style.transform = `translate3d(0, -${scrollY + navRect.top}px, 0)`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Populate inverted reflection mirror with a lightweight visual clone of <main>
|
||||||
|
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 = () => {
|
const onScroll = () => {
|
||||||
cancelAnimationFrame(rafId);
|
cancelAnimationFrame(rafId);
|
||||||
rafId = requestAnimationFrame(updateWave);
|
rafId = requestAnimationFrame(updateMirror);
|
||||||
};
|
};
|
||||||
|
|
||||||
const lenis = (window as any).lenis;
|
const lenis = (window as any).lenis;
|
||||||
if (lenis && typeof lenis.on === 'function') {
|
if (lenis && typeof lenis.on === 'function') {
|
||||||
lenis.on('scroll', updateWave);
|
lenis.on('scroll', updateMirror);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('scroll', onScroll, { passive: true });
|
window.addEventListener('scroll', onScroll, { passive: true });
|
||||||
window.addEventListener('resize', onScroll, { passive: true });
|
window.addEventListener('resize', onScroll, { passive: true });
|
||||||
updateWave();
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
clearTimeout(timer);
|
||||||
if (lenis && typeof lenis.off === 'function') {
|
if (lenis && typeof lenis.off === 'function') {
|
||||||
lenis.off('scroll', updateWave);
|
lenis.off('scroll', updateMirror);
|
||||||
}
|
}
|
||||||
window.removeEventListener('scroll', onScroll);
|
window.removeEventListener('scroll', onScroll);
|
||||||
window.removeEventListener('resize', onScroll);
|
window.removeEventListener('resize', onScroll);
|
||||||
cancelAnimationFrame(rafId);
|
cancelAnimationFrame(rafId);
|
||||||
};
|
};
|
||||||
}, []);
|
}, [pathname]);
|
||||||
|
|
||||||
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||||
const rect = e.currentTarget.getBoundingClientRect();
|
const rect = e.currentTarget.getBoundingClientRect();
|
||||||
@@ -78,29 +100,6 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="fixed top-3 sm:top-5 left-0 right-0 z-50 px-3 sm:px-6 lg:px-8 pointer-events-none transition-all duration-300">
|
<header className="fixed top-3 sm:top-5 left-0 right-0 z-50 px-3 sm:px-6 lg:px-8 pointer-events-none transition-all duration-300">
|
||||||
{/* SVG Optical Liquid Glass Refraction & Distortion Filter (Single Octave Ultra-Fast GPU Shader) */}
|
|
||||||
<svg className="absolute w-0 h-0 pointer-events-none overflow-hidden" aria-hidden="true" focusable="false">
|
|
||||||
<defs>
|
|
||||||
<filter id="glass-liquid-warp" x="-20%" y="-20%" width="140%" height="140%" colorInterpolationFilters="sRGB">
|
|
||||||
{/* Smooth fluid waves with single octave for 120 FPS mobile GPU efficiency */}
|
|
||||||
<feTurbulence type="fractalNoise" baseFrequency="0.012 0.045" numOctaves="1" result="fluidWarp" />
|
|
||||||
{/* Complete liquid displacement - completely liquefies without a hint of legible shapes */}
|
|
||||||
<feDisplacementMap in="SourceGraphic" in2="fluidWarp" scale="36" xChannelSelector="R" yChannelSelector="G" result="displaced" />
|
|
||||||
{/* Prismatic chromatic dispersion */}
|
|
||||||
<feColorMatrix
|
|
||||||
type="matrix"
|
|
||||||
in="displaced"
|
|
||||||
result="chroma"
|
|
||||||
values="1.08 0 0 0 0
|
|
||||||
0 1.0 0 0 0
|
|
||||||
0 0 1.22 0 0
|
|
||||||
0 0 0 1 0"
|
|
||||||
/>
|
|
||||||
<feColorMatrix type="saturate" values="2.4" in="chroma" result="finalDistorted" />
|
|
||||||
</filter>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
ref={navRef}
|
ref={navRef}
|
||||||
onMouseMove={handleMouseMove}
|
onMouseMove={handleMouseMove}
|
||||||
@@ -111,7 +110,8 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
|
|||||||
>
|
>
|
||||||
{/* Optical Inverted Liquid Glass Refraction Chamber */}
|
{/* Optical Inverted Liquid Glass Refraction Chamber */}
|
||||||
<div className="liquid-refraction-chamber" aria-hidden="true">
|
<div className="liquid-refraction-chamber" aria-hidden="true">
|
||||||
<div ref={mirrorRef} className="liquid-fluid-wave" />
|
<div ref={mirrorRef} className="liquid-refraction-mirror" />
|
||||||
|
<div className="liquid-caustic-refraction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Dynamic Specular Caustic Glint - Crystal clear at rest, subtle gloss on cursor interaction */}
|
{/* Dynamic Specular Caustic Glint - Crystal clear at rest, subtle gloss on cursor interaction */}
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ export function SmoothScroll() {
|
|||||||
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
||||||
|
|
||||||
const lenis = new Lenis({
|
const lenis = new Lenis({
|
||||||
duration: 1.2,
|
duration: 1.15,
|
||||||
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
|
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
|
||||||
orientation: 'vertical',
|
orientation: 'vertical',
|
||||||
gestureOrientation: 'vertical',
|
gestureOrientation: 'vertical',
|
||||||
smoothWheel: true,
|
smoothWheel: true,
|
||||||
|
syncTouch: false, // Preserves hardware 120Hz momentum touch scrolling on phones & tablets
|
||||||
wheelMultiplier: 0.95,
|
wheelMultiplier: 0.95,
|
||||||
touchMultiplier: 1.5,
|
touchMultiplier: 1.0,
|
||||||
});
|
});
|
||||||
|
|
||||||
let rafId: number;
|
let rafId: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user