feat(hero): redesign frontpage hero with high-end typography, optical 3D crystal and glassmorphic telemetry
This commit is contained in:
@@ -258,22 +258,21 @@ export function HeroSection({
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// 3. Pure Front Page Hero View (for homepage /):
|
||||
// ONLY Animated Text, 3D WebGL Prism, Particles, Radiant Colors & Effects
|
||||
// Zero tool names, zero tool selection, zero feature lists
|
||||
// Ultra-refined Typography, Optical Crystal Prism & Ambient Particles
|
||||
// -------------------------------------------------------------
|
||||
return (
|
||||
<section className="relative isolate min-h-[96vh] flex flex-col justify-center items-center text-center overflow-hidden bg-[#FAF8F5] pt-24 pb-20 px-4 sm:px-6 md:px-8 lg:px-10">
|
||||
<section className="relative isolate min-h-[96vh] flex flex-col justify-center items-center text-center overflow-hidden bg-[#FAF8F5] pt-28 pb-20 px-4 sm:px-6 md:px-8 lg:px-12">
|
||||
{/* 1. MagicUI Ambient Floating Particles */}
|
||||
<Particles
|
||||
className="absolute inset-0 -z-20 opacity-50"
|
||||
quantity={70}
|
||||
className="absolute inset-0 -z-20 opacity-40 pointer-events-none"
|
||||
quantity={60}
|
||||
color="#3b82f6"
|
||||
size={0.8}
|
||||
size={0.7}
|
||||
/>
|
||||
|
||||
{/* 2. Interactive 3D WebGL Crystal Prism Canvas Rotating Behind the Text */}
|
||||
<div className="absolute inset-0 -z-10 flex items-center justify-center pointer-events-none select-none overflow-hidden">
|
||||
<div className="w-[650px] h-[650px] sm:w-[950px] sm:h-[950px] lg:w-[1250px] lg:h-[1250px] opacity-75 transform-gpu transition-opacity duration-1000">
|
||||
<div className="w-[700px] h-[700px] sm:w-[1000px] sm:h-[1000px] lg:w-[1300px] lg:h-[1300px] opacity-85 transform-gpu transition-opacity duration-1000">
|
||||
<Hero3DCanvas className="w-full h-full" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -282,98 +281,138 @@ export function HeroSection({
|
||||
<div
|
||||
className="absolute inset-0 -z-30 pointer-events-none"
|
||||
style={{
|
||||
background: 'radial-gradient(circle at 50% 38%, rgba(59,130,246,0.16) 0%, rgba(99,102,241,0.12) 30%, rgba(6,182,212,0.08) 50%, transparent 75%)',
|
||||
background: 'radial-gradient(circle at 50% 36%, rgba(59,130,246,0.12) 0%, rgba(99,102,241,0.08) 32%, rgba(6,182,212,0.04) 55%, transparent 75%)',
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className="absolute inset-0 -z-30 pointer-events-none opacity-60"
|
||||
className="absolute inset-0 -z-30 pointer-events-none opacity-50"
|
||||
style={{
|
||||
background: 'radial-gradient(ellipse at 80% 20%, rgba(236,72,153,0.08) 0%, transparent 50%), radial-gradient(ellipse at 20% 70%, rgba(16,185,129,0.07) 0%, transparent 50%)',
|
||||
background: 'radial-gradient(ellipse at 78% 22%, rgba(236,72,153,0.06) 0%, transparent 50%), radial-gradient(ellipse at 22% 68%, rgba(16,185,129,0.05) 0%, transparent 50%)',
|
||||
}}
|
||||
/>
|
||||
<div className="absolute inset-x-0 bottom-0 h-44 bg-gradient-to-t from-[#FAF8F5] to-transparent -z-10 pointer-events-none" />
|
||||
<div className="absolute inset-x-0 bottom-0 h-40 bg-gradient-to-t from-[#FAF8F5] via-[#FAF8F5]/80 to-transparent -z-10 pointer-events-none" />
|
||||
|
||||
{/* 4. Center Hero Typography & Visual Atmosphere */}
|
||||
<div className="relative z-10 max-w-[1640px] mx-auto flex flex-col items-center justify-center w-full">
|
||||
{/* Glowing Pill Badge */}
|
||||
<div className="inline-flex items-center gap-2 rounded-full border border-blue-500/25 bg-white/90 backdrop-blur-md px-5 py-2 text-xs font-mono font-semibold tracking-wider uppercase text-blue-800 shadow-md mb-8">
|
||||
<div className="relative z-10 max-w-6xl mx-auto flex flex-col items-center justify-center w-full">
|
||||
{/* Ambient Frosted Eyebrow Badge */}
|
||||
<div className="inline-flex items-center gap-2.5 rounded-full border border-slate-900/[0.08] bg-white/80 backdrop-blur-xl px-4 py-1.5 text-xs font-mono font-medium tracking-wider uppercase text-slate-800 shadow-[0_2px_12px_-4px_rgba(15,23,42,0.06),inset_0_1px_0_rgba(255,255,255,0.8)] transition-all duration-300 hover:border-blue-500/30 hover:bg-white mb-8 sm:mb-9 group cursor-default">
|
||||
<span className="flex h-2 w-2 relative">
|
||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"></span>
|
||||
<span className="relative inline-flex rounded-full h-2 w-2 bg-blue-600"></span>
|
||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75" />
|
||||
<span className="relative inline-flex rounded-full h-2 w-2 bg-gradient-to-r from-blue-600 to-cyan-500" />
|
||||
</span>
|
||||
<span className="text-slate-700 tracking-wider font-semibold text-[11px] sm:text-xs">
|
||||
{resolvedBadge}
|
||||
</span>
|
||||
<span className="h-3 w-px bg-slate-200" />
|
||||
<span className="text-[10px] font-mono font-bold uppercase tracking-wider text-blue-600 bg-blue-50 px-2 py-0.5 rounded-full border border-blue-200/50">
|
||||
v4.2 PRO
|
||||
</span>
|
||||
<span>{resolvedBadge}</span>
|
||||
</div>
|
||||
|
||||
{/* Grand Headline with Character-Level MagicUI Animation */}
|
||||
<h1 className="text-5xl sm:text-7xl md:text-8xl lg:text-[6.5rem] font-display font-black tracking-[-0.045em] text-slate-900 leading-[1.02] max-w-5xl mx-auto text-balance">
|
||||
<span className="block text-slate-900">
|
||||
{/* Grand Headline: Masterpiece Proportions, Zero Awkward Wraps */}
|
||||
<h1 className="text-3xl sm:text-5xl md:text-6xl lg:text-[5.2rem] xl:text-[5.8rem] font-display font-extrabold tracking-[-0.035em] leading-[1.08] max-w-6xl mx-auto text-balance">
|
||||
<span className="block text-slate-950 pb-1 sm:pb-2">
|
||||
<TextAnimate animation="slideLeft" by="character">
|
||||
Imagine. Transform.
|
||||
</TextAnimate>
|
||||
</span>
|
||||
<span className="block mt-2 sm:mt-3 text-blue-600 font-extrabold pb-2">
|
||||
<TextAnimate animation="slideLeft" by="character" delay={0.2}>
|
||||
<span className="block mt-1 sm:mt-2 bg-gradient-to-r from-blue-600 via-indigo-600 to-cyan-500 bg-clip-text text-transparent pb-3 sm:whitespace-nowrap">
|
||||
<TextAnimate animation="slideLeft" by="character" delay={0.15}>
|
||||
Create the Impossible.
|
||||
</TextAnimate>
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
{/* Inspiring, Universal Subtitle (No features, no tool lists) */}
|
||||
<p className="mt-8 text-lg sm:text-xl lg:text-2xl text-slate-600 max-w-3xl mx-auto font-sans leading-relaxed text-pretty">
|
||||
{/* Inspiring, Refined Editorial Subtitle */}
|
||||
<p className="mt-6 sm:mt-7 text-base sm:text-lg md:text-xl text-slate-600/90 max-w-2xl sm:max-w-3xl mx-auto font-sans leading-relaxed tracking-[-0.01em] text-balance">
|
||||
<TextAnimate animation="fadeIn" by="word" delay={0.25}>
|
||||
Turn ordinary moments into extraordinary visual art. Instant, effortless, and private photo magic right in your browser.
|
||||
</TextAnimate>
|
||||
</p>
|
||||
|
||||
{/* Elegant Action Buttons */}
|
||||
<div className="mt-10 flex flex-wrap items-center justify-center gap-4">
|
||||
{/* Luxury CTA Action Buttons */}
|
||||
<div className="mt-9 sm:mt-10 flex flex-wrap items-center justify-center gap-4 sm:gap-5">
|
||||
<a
|
||||
href={primaryCtaHref}
|
||||
className="group inline-flex items-center gap-3 rounded-full bg-gradient-to-r from-slate-950 via-slate-900 to-indigo-950 px-9 py-4 text-xs sm:text-sm font-bold text-white border border-white/15 shadow-xl shadow-slate-900/20 transition-[transform,opacity] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] hover:scale-105 active:scale-95"
|
||||
className="group relative inline-flex items-center gap-3 rounded-full bg-slate-950 px-8 sm:px-9 py-4 text-xs sm:text-sm font-semibold tracking-tight text-white border border-white/10 shadow-[0_4px_20px_-4px_rgba(15,23,42,0.3),0_0_0_1px_rgba(255,255,255,0.08)_inset] hover:shadow-[0_8px_30px_-6px_rgba(37,99,235,0.4),0_0_0_1px_rgba(59,130,246,0.3)] transition-all duration-300 ease-out hover:scale-[1.03] active:scale-[0.98] cursor-pointer"
|
||||
>
|
||||
<span>{primaryCtaLabel}</span>
|
||||
<ArrowDown className="w-4 h-4 transition-transform duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] group-hover:translate-y-0.5" />
|
||||
<span className="w-6 h-6 rounded-full bg-white/10 flex items-center justify-center group-hover:bg-blue-600 transition-colors duration-300">
|
||||
<ArrowDown className="w-3.5 h-3.5 transition-transform duration-300 ease-out group-hover:translate-y-0.5" />
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href={secondaryCtaHref}
|
||||
className="inline-flex items-center gap-2.5 rounded-full border border-slate-300/80 bg-white/90 backdrop-blur-md px-8 py-4 text-xs sm:text-sm font-semibold text-slate-800 shadow-sm transition-[transform,opacity,border-color,color] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] hover:scale-105 hover:border-blue-400 hover:text-blue-600 hover:bg-white active:scale-95"
|
||||
className="group inline-flex items-center gap-2.5 rounded-full border border-slate-200/90 bg-white/80 hover:bg-white backdrop-blur-xl px-7 sm:px-8 py-4 text-xs sm:text-sm font-semibold tracking-tight text-slate-800 hover:text-slate-950 shadow-[0_4px_16px_-4px_rgba(15,23,42,0.06)] hover:shadow-[0_8px_24px_-6px_rgba(15,23,42,0.1)] hover:border-blue-400/60 transition-all duration-300 ease-out hover:scale-[1.03] active:scale-[0.98] cursor-pointer"
|
||||
>
|
||||
<Smartphone className="w-4 h-4 text-blue-600" />
|
||||
<Smartphone className="w-4 h-4 text-blue-600 group-hover:scale-110 transition-transform duration-300" />
|
||||
<span>{secondaryCtaLabel}</span>
|
||||
<span className="px-1.5 py-0.5 rounded text-[10px] font-mono font-bold bg-blue-50 text-blue-700 border border-blue-200/60">
|
||||
iOS / Android
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Dynamic Elemental Platform Telemetry Strip (Making space useful & rich) */}
|
||||
<div className="mt-12 w-full max-w-5xl rounded-3xl bg-white/75 backdrop-blur-xl border border-slate-200/90 p-5 sm:p-6 shadow-sm flex flex-wrap items-center justify-around gap-6 text-center transform-gpu">
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-slate-900">1.4M+</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Photos Transformed</div>
|
||||
{/* Floating Glass Telemetry & Capability Capsule */}
|
||||
<div className="mt-14 sm:mt-16 w-full max-w-4xl mx-auto rounded-2xl sm:rounded-full bg-white/85 backdrop-blur-2xl border border-slate-900/[0.08] shadow-[0_16px_40px_-16px_rgba(15,23,42,0.08),0_0_0_1px_rgba(255,255,255,0.8)_inset] p-4 sm:py-5 sm:px-8 grid grid-cols-2 sm:flex sm:items-center sm:justify-around gap-4 sm:gap-6 text-center transform-gpu">
|
||||
{/* Metric 1 */}
|
||||
<div className="flex flex-col items-center justify-center p-2 sm:p-0">
|
||||
<div className="text-2xl sm:text-3xl font-display font-black tracking-tight bg-gradient-to-b from-slate-950 via-slate-900 to-slate-700 bg-clip-text text-transparent">
|
||||
1.4M+
|
||||
</div>
|
||||
<div className="text-[11px] font-mono font-semibold uppercase tracking-wider text-slate-500 mt-1">
|
||||
Photos Transformed
|
||||
</div>
|
||||
</div>
|
||||
<div className="hidden sm:block w-px h-10 bg-slate-200" />
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-blue-600">< 0.8s</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Instant Inference</div>
|
||||
|
||||
<div className="hidden sm:block w-px h-10 bg-gradient-to-b from-transparent via-slate-200 to-transparent" />
|
||||
|
||||
{/* Metric 2 */}
|
||||
<div className="flex flex-col items-center justify-center p-2 sm:p-0">
|
||||
<div className="text-2xl sm:text-3xl font-display font-black tracking-tight bg-gradient-to-r from-blue-600 to-cyan-500 bg-clip-text text-transparent">
|
||||
< 0.8s
|
||||
</div>
|
||||
<div className="text-[11px] font-mono font-semibold uppercase tracking-wider text-slate-500 mt-1">
|
||||
Instant Inference
|
||||
</div>
|
||||
</div>
|
||||
<div className="hidden sm:block w-px h-10 bg-slate-200" />
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-emerald-600">100%</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Client-Side Privacy</div>
|
||||
|
||||
<div className="hidden sm:block w-px h-10 bg-gradient-to-b from-transparent via-slate-200 to-transparent" />
|
||||
|
||||
{/* Metric 3 */}
|
||||
<div className="flex flex-col items-center justify-center p-2 sm:p-0">
|
||||
<div className="text-2xl sm:text-3xl font-display font-black tracking-tight bg-gradient-to-r from-emerald-600 to-teal-500 bg-clip-text text-transparent">
|
||||
100%
|
||||
</div>
|
||||
<div className="text-[11px] font-mono font-semibold uppercase tracking-wider text-slate-500 mt-1">
|
||||
Client-Side Privacy
|
||||
</div>
|
||||
</div>
|
||||
<div className="hidden sm:block w-px h-10 bg-slate-200" />
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-display font-black text-indigo-600">4K Lossless</div>
|
||||
<div className="text-[11px] font-mono font-medium text-slate-500 uppercase tracking-wider mt-0.5">Studio Resolution</div>
|
||||
|
||||
<div className="hidden sm:block w-px h-10 bg-gradient-to-b from-transparent via-slate-200 to-transparent" />
|
||||
|
||||
{/* Metric 4 */}
|
||||
<div className="flex flex-col items-center justify-center p-2 sm:p-0">
|
||||
<div className="text-2xl sm:text-3xl font-display font-black tracking-tight bg-gradient-to-r from-indigo-600 via-purple-600 to-pink-500 bg-clip-text text-transparent">
|
||||
4K UHD
|
||||
</div>
|
||||
<div className="text-[11px] font-mono font-semibold uppercase tracking-wider text-slate-500 mt-1">
|
||||
Studio Resolution
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Gentle Scroll Cue */}
|
||||
{/* Subtle Luxury Scroll Cue */}
|
||||
<a
|
||||
href="#our-tools"
|
||||
aria-label="Scroll to our tools"
|
||||
className="mt-8 inline-flex flex-col items-center gap-2 text-[11px] font-mono uppercase tracking-widest text-slate-500 hover:text-blue-600 transition-colors"
|
||||
className="mt-8 sm:mt-10 inline-flex flex-col items-center gap-2 text-[10px] font-mono uppercase tracking-widest text-slate-400 hover:text-blue-600 transition-colors group cursor-pointer"
|
||||
>
|
||||
<span>Scroll to Explore</span>
|
||||
<span className="w-4 h-7 rounded-full border border-slate-300 flex justify-center p-1">
|
||||
<span className="font-semibold tracking-widest text-slate-400 group-hover:text-blue-600 transition-colors">
|
||||
Scroll to Explore
|
||||
</span>
|
||||
<span className="w-4 h-7 rounded-full border border-slate-300 group-hover:border-blue-400 flex justify-center p-1 transition-colors">
|
||||
<span className="w-1 h-1.5 rounded-full bg-blue-600 animate-bounce" />
|
||||
</span>
|
||||
</a>
|
||||
@@ -393,82 +432,111 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
const container = containerRef.current;
|
||||
if (!container) return;
|
||||
|
||||
let width = container.clientWidth || 600;
|
||||
let height = container.clientHeight || 600;
|
||||
let width = container.clientWidth || 800;
|
||||
let height = container.clientHeight || 800;
|
||||
|
||||
const scene = new THREE.Scene();
|
||||
const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100);
|
||||
camera.position.z = 4.2;
|
||||
camera.position.z = 4.8;
|
||||
|
||||
let renderer: THREE.WebGLRenderer | null = null;
|
||||
try {
|
||||
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false, powerPreference: 'high-performance' });
|
||||
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true, powerPreference: 'high-performance' });
|
||||
renderer.setSize(width, height);
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 1.5));
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
|
||||
container.appendChild(renderer.domElement);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Geometry: Floating Octahedron Crystal Prism
|
||||
const geometry = new THREE.OctahedronGeometry(1.65, 0);
|
||||
const material = new THREE.MeshStandardMaterial({
|
||||
color: 0x2563eb,
|
||||
// Master Group for smooth coordinated rotation
|
||||
const masterGroup = new THREE.Group();
|
||||
scene.add(masterGroup);
|
||||
|
||||
// 1. Central Optical Translucent Crystal (Icosahedron, non-obstructive)
|
||||
const crystalGeo = new THREE.IcosahedronGeometry(1.25, 0);
|
||||
const crystalMat = new THREE.MeshPhysicalMaterial({
|
||||
color: 0x3b82f6,
|
||||
emissive: 0x1d4ed8,
|
||||
emissiveIntensity: 0.25,
|
||||
roughness: 0.2,
|
||||
metalness: 0.2,
|
||||
emissiveIntensity: 0.1,
|
||||
roughness: 0.15,
|
||||
metalness: 0.1,
|
||||
transmission: 0.9,
|
||||
transparent: true,
|
||||
opacity: 0.8,
|
||||
opacity: 0.11,
|
||||
ior: 1.4,
|
||||
});
|
||||
const crystal = new THREE.Mesh(crystalGeo, crystalMat);
|
||||
masterGroup.add(crystal);
|
||||
|
||||
const crystal = new THREE.Mesh(geometry, material);
|
||||
scene.add(crystal);
|
||||
|
||||
// Wireframe Cage
|
||||
const wireGeo = new THREE.WireframeGeometry(geometry);
|
||||
// Wireframe Fine Lines for the Crystal
|
||||
const wireGeo = new THREE.WireframeGeometry(crystalGeo);
|
||||
const wireMat = new THREE.LineBasicMaterial({
|
||||
color: 0x93c5fd,
|
||||
color: 0x60a5fa,
|
||||
transparent: true,
|
||||
opacity: 0.35,
|
||||
opacity: 0.22,
|
||||
});
|
||||
const wireframe = new THREE.LineSegments(wireGeo, wireMat);
|
||||
crystal.add(wireframe);
|
||||
|
||||
// Subtle Particle Constellation
|
||||
const particleCount = 35;
|
||||
// 2. Dual Gyro Gimbal Orbital Rings (Sleek Apple/Quantum Aesthetic)
|
||||
// Ring 1 (Cyan orbital ring)
|
||||
const ring1Geo = new THREE.TorusGeometry(2.15, 0.007, 16, 120);
|
||||
const ring1Mat = new THREE.MeshBasicMaterial({
|
||||
color: 0x38bdf8,
|
||||
transparent: true,
|
||||
opacity: 0.20,
|
||||
});
|
||||
const ring1 = new THREE.Mesh(ring1Geo, ring1Mat);
|
||||
ring1.rotation.x = Math.PI / 3.2;
|
||||
masterGroup.add(ring1);
|
||||
|
||||
// Ring 2 (Indigo tilted orbital ring)
|
||||
const ring2Geo = new THREE.TorusGeometry(1.8, 0.007, 16, 100);
|
||||
const ring2Mat = new THREE.MeshBasicMaterial({
|
||||
color: 0x818cf8,
|
||||
transparent: true,
|
||||
opacity: 0.16,
|
||||
});
|
||||
const ring2 = new THREE.Mesh(ring2Geo, ring2Mat);
|
||||
ring2.rotation.y = Math.PI / 4;
|
||||
ring2.rotation.z = Math.PI / 6;
|
||||
masterGroup.add(ring2);
|
||||
|
||||
// 3. Subtle Constellation of Ambient Starlight Particles
|
||||
const particleCount = 40;
|
||||
const particleGeo = new THREE.BufferGeometry();
|
||||
const posArray = new Float32Array(particleCount * 3);
|
||||
for (let i = 0; i < particleCount * 3; i++) {
|
||||
posArray[i] = (Math.random() - 0.5) * 6;
|
||||
posArray[i] = (Math.random() - 0.5) * 7.5;
|
||||
}
|
||||
particleGeo.setAttribute('position', new THREE.BufferAttribute(posArray, 3));
|
||||
const particleMat = new THREE.PointsMaterial({
|
||||
size: 0.04,
|
||||
color: 0x60a5fa,
|
||||
size: 0.03,
|
||||
color: 0x93c5fa,
|
||||
transparent: true,
|
||||
opacity: 0.5,
|
||||
opacity: 0.35,
|
||||
});
|
||||
const particles = new THREE.Points(particleGeo, particleMat);
|
||||
scene.add(particles);
|
||||
masterGroup.add(particles);
|
||||
|
||||
// Studio Lights
|
||||
const ambientLight = new THREE.AmbientLight(0xffffff, 0.85);
|
||||
// 4. Studio Lighting
|
||||
const ambientLight = new THREE.AmbientLight(0xffffff, 1.2);
|
||||
scene.add(ambientLight);
|
||||
|
||||
const pointLight = new THREE.PointLight(0x06b6d4, 3, 10);
|
||||
pointLight.position.set(3, 3, 3);
|
||||
scene.add(pointLight);
|
||||
const cyanLight = new THREE.PointLight(0x06b6d4, 2.2, 12);
|
||||
cyanLight.position.set(3.5, 3, 3);
|
||||
scene.add(cyanLight);
|
||||
|
||||
const pointLight2 = new THREE.PointLight(0x4f46e5, 2.5, 10);
|
||||
pointLight2.position.set(-3, -2, 2);
|
||||
scene.add(pointLight2);
|
||||
const indigoLight = new THREE.PointLight(0x6366f1, 1.8, 12);
|
||||
indigoLight.position.set(-3.5, -2, 2.5);
|
||||
scene.add(indigoLight);
|
||||
|
||||
let animId = 0;
|
||||
let clock = new THREE.Clock();
|
||||
let isVisible = true;
|
||||
|
||||
// IntersectionObserver to pause loop when scrolled out of view!
|
||||
// IntersectionObserver to pause loop when scrolled out of view (0% CPU/GPU offscreen)
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
@@ -481,14 +549,24 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
|
||||
const animate = () => {
|
||||
animId = requestAnimationFrame(animate);
|
||||
if (!isVisible) return; // Zero GPU work when offscreen!
|
||||
if (!isVisible) return;
|
||||
|
||||
const elapsed = clock.getElapsedTime();
|
||||
crystal.rotation.x = elapsed * 0.18;
|
||||
crystal.rotation.y = elapsed * 0.25;
|
||||
|
||||
particles.rotation.y = elapsed * 0.05;
|
||||
particles.rotation.x = elapsed * 0.03;
|
||||
// Fluid crystal rotation
|
||||
crystal.rotation.x = elapsed * 0.12;
|
||||
crystal.rotation.y = elapsed * 0.16;
|
||||
|
||||
// Gimbal ring orbital movements
|
||||
ring1.rotation.z = elapsed * 0.14;
|
||||
ring1.rotation.x = Math.PI / 3.2 + Math.sin(elapsed * 0.25) * 0.08;
|
||||
|
||||
ring2.rotation.y = -elapsed * 0.11;
|
||||
ring2.rotation.z = Math.PI / 6 + Math.cos(elapsed * 0.2) * 0.1;
|
||||
|
||||
// Particle constellation subtle drift
|
||||
particles.rotation.y = elapsed * 0.03;
|
||||
particles.rotation.x = elapsed * 0.02;
|
||||
|
||||
if (renderer) renderer.render(scene, camera);
|
||||
};
|
||||
@@ -513,8 +591,16 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
if (renderer && renderer.domElement && container.contains(renderer.domElement)) {
|
||||
container.removeChild(renderer.domElement);
|
||||
}
|
||||
geometry.dispose();
|
||||
material.dispose();
|
||||
crystalGeo.dispose();
|
||||
crystalMat.dispose();
|
||||
wireGeo.dispose();
|
||||
wireMat.dispose();
|
||||
ring1Geo.dispose();
|
||||
ring1Mat.dispose();
|
||||
ring2Geo.dispose();
|
||||
ring2Mat.dispose();
|
||||
particleGeo.dispose();
|
||||
particleMat.dispose();
|
||||
renderer?.dispose();
|
||||
};
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user