feat(ui): eliminate empty space, add categories to squarical trendy effects, optimize 120fps animations and smooth cursor
This commit is contained in:
@@ -181,17 +181,34 @@ export function HeroSection({
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Floating 3D Prismatic Light Halo */}
|
||||
<div className="mt-14 relative w-full max-w-4xl h-24 flex items-center justify-center pointer-events-none">
|
||||
<div className="w-3/4 h-8 bg-gradient-to-r from-transparent via-blue-500/20 to-transparent blur-2xl" />
|
||||
<div className="w-1/2 h-1 bg-gradient-to-r from-transparent via-cyan-400 to-transparent shadow-[0_0_20px_rgba(6,182,212,0.8)]" />
|
||||
{/* 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>
|
||||
</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>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
{/* Gentle Scroll Cue */}
|
||||
<a
|
||||
href="#our-tools"
|
||||
aria-label="Scroll to our tools"
|
||||
className="mt-6 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 inline-flex flex-col items-center gap-2 text-[11px] font-mono uppercase tracking-widest text-slate-500 hover:text-blue-600 transition-colors"
|
||||
>
|
||||
<span>Scroll to Explore</span>
|
||||
<span className="w-4 h-7 rounded-full border border-slate-300 flex justify-center p-1">
|
||||
@@ -205,6 +222,7 @@ export function HeroSection({
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Interactive 3D WebGL Crystal Prism Background Canvas
|
||||
// (Optimized with IntersectionObserver: 0% GPU when offscreen)
|
||||
// -------------------------------------------------------------
|
||||
function Hero3DCanvas({ className }: { className?: string }) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
@@ -222,9 +240,9 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
|
||||
let renderer: THREE.WebGLRenderer | null = null;
|
||||
try {
|
||||
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
|
||||
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: false, powerPreference: 'high-performance' });
|
||||
renderer.setSize(width, height);
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 1.5));
|
||||
container.appendChild(renderer.domElement);
|
||||
} catch (e) {
|
||||
return;
|
||||
@@ -258,7 +276,7 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
crystal.add(wireframe);
|
||||
|
||||
// Subtle Particle Constellation
|
||||
const particleCount = 45;
|
||||
const particleCount = 35;
|
||||
const particleGeo = new THREE.BufferGeometry();
|
||||
const posArray = new Float32Array(particleCount * 3);
|
||||
for (let i = 0; i < particleCount * 3; i++) {
|
||||
@@ -288,11 +306,24 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
|
||||
let animId = 0;
|
||||
let clock = new THREE.Clock();
|
||||
let isVisible = true;
|
||||
|
||||
// IntersectionObserver to pause loop when scrolled out of view!
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
isVisible = entry.isIntersecting;
|
||||
});
|
||||
},
|
||||
{ threshold: 0.05 }
|
||||
);
|
||||
observer.observe(container);
|
||||
|
||||
const animate = () => {
|
||||
animId = requestAnimationFrame(animate);
|
||||
const elapsed = clock.getElapsedTime();
|
||||
if (!isVisible) return; // Zero GPU work when offscreen!
|
||||
|
||||
const elapsed = clock.getElapsedTime();
|
||||
crystal.rotation.x = elapsed * 0.18;
|
||||
crystal.rotation.y = elapsed * 0.25;
|
||||
|
||||
@@ -313,10 +344,11 @@ function Hero3DCanvas({ className }: { className?: string }) {
|
||||
renderer.setSize(w, h);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
window.addEventListener('resize', handleResize, { passive: true });
|
||||
|
||||
return () => {
|
||||
cancelAnimationFrame(animId);
|
||||
observer.disconnect();
|
||||
window.removeEventListener('resize', handleResize);
|
||||
if (renderer && renderer.domElement && container.contains(renderer.domElement)) {
|
||||
container.removeChild(renderer.domElement);
|
||||
|
||||
Reference in New Issue
Block a user