feat(3d): complete site-wide autonomous and interactive 3d cinematic typography overhaul

This commit is contained in:
2026-11-03 17:08:23 +05:30
parent c764ffca14
commit 6cba2256b4
14 changed files with 340 additions and 72 deletions
+87
View File
@@ -316,3 +316,90 @@
-webkit-text-fill-color: transparent;
}
/* Universal 3D Cinematic Extruded Typography */
h1, h2, h3, h4, h5, h6, .font-display, .text-3d-chiseled {
transform-style: preserve-3d;
will-change: transform;
text-shadow:
0 1px 0 #FFFFFF,
0 2px 0 #E5DCCE,
0 3px 1px #D6C7B2,
0 4px 2px #C5B298,
0 6px 6px rgba(15, 23, 42, 0.12),
0 12px 24px rgba(15, 23, 42, 0.08);
}
/* 3D Extruded Stat Numbers & Metric Badges */
.stat-value, .stat-number, [data-stat] {
display: inline-block;
transform-style: preserve-3d;
will-change: transform;
filter:
drop-shadow(0 1px 0 #FFFFFF)
drop-shadow(0 2px 0 #E2D6C3)
drop-shadow(0 4px 2px rgba(197, 168, 128, 0.5))
drop-shadow(0 8px 18px rgba(37, 99, 235, 0.35));
}
/* 3D Kinetic Light Sweep Animation across Gradient Headings */
@keyframes text-3d-shimmer {
0% {
background-position: 0% center;
}
50% {
background-position: 100% center;
}
100% {
background-position: 0% center;
}
}
/* Continuous Organic 3D Floating Wave */
@keyframes text-3d-float-organic {
0%, 100% {
transform: perspective(900px) rotateX(0deg) rotateY(0deg) translateZ(14px);
}
25% {
transform: perspective(900px) rotateX(2.5deg) rotateY(-3deg) translateZ(24px);
}
50% {
transform: perspective(900px) rotateX(-2deg) rotateY(2.5deg) translateZ(16px);
}
75% {
transform: perspective(900px) rotateX(2deg) rotateY(1.8deg) translateZ(26px);
}
}
/* 3D Gradient Text Styling with Multi-Plane Depth */
.text-3d-gradient,
.text-transparent.bg-clip-text {
background-size: 200% auto;
animation: text-3d-shimmer 6s ease-in-out infinite;
display: inline-block;
transform-style: preserve-3d;
filter:
drop-shadow(0 1px 0 rgba(255, 255, 255, 0.95))
drop-shadow(0 2px 1px rgba(197, 168, 128, 0.55))
drop-shadow(0 5px 12px rgba(37, 99, 235, 0.32))
drop-shadow(0 14px 28px rgba(15, 23, 42, 0.1));
}
/* Continuous 3D Spatial Pulse for Badges & Telemetry */
@keyframes badge-3d-pulse {
0%, 100% {
transform: perspective(600px) translateZ(8px) rotateX(0deg) rotateY(0deg);
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
50% {
transform: perspective(600px) translateZ(18px) rotateX(3.5deg) rotateY(-2deg);
box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18), inset 0 1px 0 rgba(255, 255, 255, 1);
}
}
.badge-3d, [class*="badge"]:not([data-no3d]) {
animation: badge-3d-pulse 4s ease-in-out infinite;
transform-style: preserve-3d;
display: inline-flex;
}
+2
View File
@@ -6,6 +6,7 @@ import { Navbar } from '@/components/ui/Navbar';
import { Footer } from '@/components/ui/Footer';
import { CursorAura } from '@/components/ui/CursorAura';
import { SmoothScroll } from '@/components/ui/SmoothScroll';
import { Cinematic3DTextEngine } from '@/components/ui/Cinematic3DTextEngine';
const sansFont = Plus_Jakarta_Sans({
subsets: ['latin'],
@@ -92,6 +93,7 @@ export default function RootLayout({
<body className="min-h-screen flex flex-col antialiased selection:bg-blue-600 selection:text-white bg-[#FAF8F5] text-slate-900 relative">
<SmoothScroll />
<CursorAura />
<Cinematic3DTextEngine />
<Navbar config={config} currentLocale="en" />
<main className="flex-1">{children}</main>
<Footer config={config} currentLocale="en" />
+5 -5
View File
@@ -23,9 +23,9 @@ export function AppCardsSection({
<section className="py-20 sm:py-28 bg-[#F5F2EB] border-y border-slate-900/[0.08]">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
{(title || subtitle) && (
<div className="text-center max-w-3xl mx-auto mb-16 space-y-3">
<div className="text-center max-w-3xl mx-auto mb-16 space-y-3 preserve-3d">
{title && (
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight">
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight text-3d-chiseled">
{resolveLocalised(title, locale)}
</h2>
)}
@@ -41,7 +41,7 @@ export function AppCardsSection({
{apps.map((app) => (
<div
key={app.id}
className="bg-white rounded-3xl p-7 border border-slate-900/[0.08] shadow-cream-sm hover:shadow-cream-md hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 flex flex-col justify-between"
className="bg-white rounded-3xl p-7 border border-slate-900/[0.08] shadow-cream-sm hover:shadow-cream-md hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 flex flex-col justify-between preserve-3d"
>
<div>
{/* Header: Icon & Rating */}
@@ -50,7 +50,7 @@ export function AppCardsSection({
<Smartphone className="w-6 h-6" />
</div>
{showRating && (
<div className="flex items-center gap-1.5 bg-amber-50 border border-amber-200 px-3 py-1.5 rounded-full text-xs font-bold text-amber-800 shadow-sm">
<div className="badge-3d flex items-center gap-1.5 bg-amber-50 border border-amber-200 px-3 py-1.5 rounded-full text-xs font-bold text-amber-800 shadow-sm">
<Star className="w-3.5 h-3.5 fill-amber-400 text-amber-400" />
<span>{app.rating.value}</span>
<span className="text-[10px] text-amber-600 font-normal">({(app.rating.count / 1000).toFixed(1)}k)</span>
@@ -58,7 +58,7 @@ export function AppCardsSection({
)}
</div>
<h3 className="text-xl font-display font-bold text-slate-900">
<h3 className="text-xl font-display font-bold text-slate-900 text-3d-chiseled">
{resolveLocalised(app.name, locale)}
</h3>
<p className="mt-1 text-xs text-blue-600 font-bold tracking-wide">
+3 -3
View File
@@ -57,12 +57,12 @@ export function AppPickerSection({
return (
<section className="py-20 sm:py-28 bg-[#F5F2EB] border-t border-slate-900/[0.08]">
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="text-center space-y-3 mb-12">
<div className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 text-blue-700 text-xs font-mono font-semibold border border-blue-200 shadow-sm">
<div className="text-center space-y-3 mb-12 preserve-3d">
<div className="badge-3d inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 text-blue-700 text-xs font-mono font-semibold border border-blue-200 shadow-sm">
<HelpCircle className="w-3.5 h-3.5 text-blue-600" />
<span>INTERACTIVE APP MATCHER</span>
</div>
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight">
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight text-3d-chiseled">
{resolveLocalised(title, locale, 'Not Sure Which App You Need?')}
</h2>
<p className="text-base sm:text-lg text-slate-600 max-w-lg mx-auto font-normal">
@@ -176,12 +176,12 @@ export function CinematicHorizontalScrollSection() {
{/* Section Top Header & Navigation Telemetry with 3D Depth */}
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 w-full z-10 flex flex-col sm:flex-row sm:items-end justify-between gap-4">
<div className="preserve-3d">
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-blue-50/90 border border-blue-200/80 text-[11px] font-mono font-semibold text-blue-700 mb-2 shadow-sm">
<div className="badge-3d inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-blue-50/90 border border-blue-200/80 text-[11px] font-mono font-semibold text-blue-700 mb-2 shadow-sm">
<Sparkles className="w-3.5 h-3.5 text-blue-600" />
<span>HORIZONTAL 3D CINEMATIC ARCHIVE</span>
</div>
<h2 className="text-2xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight">
Flagship Transformations <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600">In Real-Time</span>
<h2 className="text-2xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight text-3d-chiseled">
Flagship Transformations <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600 text-3d-gradient">In Real-Time</span>
</h2>
</div>
@@ -241,9 +241,9 @@ export function CinematicHorizontalScrollSection() {
{/* Card 3D Stereoscopic Typography Stack */}
<div className="space-y-3 preserve-3d">
{/* Headline at translateZ 45px */}
{/* Headline at translateZ 45px with 3D Chiseled Extrusion */}
<h3
className="text-xl sm:text-2xl font-display font-bold text-slate-900 tracking-tight preserve-3d drop-shadow-[0_2px_8px_rgba(15,23,42,0.08)]"
className="text-xl sm:text-2xl font-display font-bold text-slate-900 tracking-tight preserve-3d text-3d-chiseled"
style={{ transform: 'translateZ(45px)' }}
>
{card.title}
+4 -4
View File
@@ -25,13 +25,13 @@ export function FaqSection({
return (
<section className="py-24 sm:py-32 bg-[#FAF8F5] border-t border-slate-900/[0.08]">
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="text-center max-w-3xl mx-auto mb-16 space-y-3">
<div className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700">
<div className="text-center max-w-3xl mx-auto mb-16 space-y-3 preserve-3d">
<div className="badge-3d inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700">
<HelpCircle className="w-3.5 h-3.5 text-blue-600" />
<span>TRANSPARENCY & ASSURANCE</span>
</div>
{title && (
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight">
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight text-3d-chiseled">
{resolveLocalised(title, locale)}
</h2>
)}
@@ -49,7 +49,7 @@ export function FaqSection({
onClick={() => setOpenIndex(isOpen ? null : idx)}
className="w-full p-6 text-left flex items-center justify-between gap-4 font-bold text-slate-900 hover:text-blue-600 transition-colors"
>
<span className="text-base sm:text-lg font-display">{item.q}</span>
<span className="text-base sm:text-lg font-display text-3d-chiseled">{item.q}</span>
<ChevronDown
className={`w-5 h-5 text-slate-400 shrink-0 transition-transform duration-200 ${
isOpen ? 'rotate-180 text-blue-600' : ''
+3 -3
View File
@@ -63,9 +63,9 @@ export function HeroSection({
{/* Main Hero Header */}
<div className="text-center max-w-4xl mx-auto space-y-6 mb-12 sm:mb-16 relative z-10">
{/* Live Core Status & Enigma Editorial Metadata */}
<div className="flex flex-wrap items-center justify-center gap-2.5">
<div className="flex flex-wrap items-center justify-center gap-2.5 preserve-3d">
{resolvedBadge && (
<div className="inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-blue-50/90 border border-blue-200/80 text-xs font-mono font-semibold text-blue-700 shadow-sm backdrop-blur-sm">
<div className="badge-3d inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-blue-50/90 border border-blue-200/80 text-xs font-mono font-semibold text-blue-700 shadow-sm backdrop-blur-sm">
<span className="relative flex h-2 w-2">
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-500 opacity-75"></span>
<span className="relative inline-flex rounded-full h-2 w-2 bg-blue-600"></span>
@@ -73,7 +73,7 @@ export function HeroSection({
<span>{resolvedBadge}</span>
</div>
)}
<div className="hidden sm:inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-amber-50/80 border border-amber-200/60 text-[11px] font-mono font-bold text-amber-800 shadow-sm">
<div className="badge-3d hidden sm:inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-amber-50/80 border border-amber-200/60 text-[11px] font-mono font-bold text-amber-800 shadow-sm">
<span>VOL. 26 // NEURAL STUDIO</span>
</div>
</div>
+9 -3
View File
@@ -15,11 +15,17 @@ export function StatsSection({ items = [] }: StatsSectionProps) {
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
<div className="grid grid-cols-2 md:grid-cols-4 gap-8 text-center divide-y md:divide-y-0 md:divide-x divide-slate-200">
{items.map((stat, idx) => (
<div key={idx} className="pt-4 md:pt-0 space-y-1.5">
<p className="text-3xl sm:text-4xl lg:text-5xl font-display font-black bg-clip-text text-transparent bg-gradient-to-r from-blue-700 via-indigo-600 to-purple-600 tracking-tight">
<div key={idx} className="pt-4 md:pt-0 space-y-2 preserve-3d perspective-800 group hover:-translate-y-1 transition-transform duration-300">
<p
className="text-4xl sm:text-5xl lg:text-6xl font-display font-black bg-clip-text text-transparent bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600 tracking-tight stat-value inline-block preserve-3d"
style={{ transform: 'translateZ(30px)' }}
>
{stat.value}
</p>
<p className="text-xs font-mono uppercase tracking-wider text-slate-500 font-semibold">
<p
className="text-xs font-mono uppercase tracking-wider text-slate-600 font-bold block preserve-3d"
style={{ transform: 'translateZ(14px)' }}
>
{stat.label}
</p>
</div>
@@ -73,7 +73,7 @@ export function TransformationReelSection() {
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-500 opacity-75"></span>
<span className="relative inline-flex rounded-full h-2 w-2 bg-blue-600"></span>
</span>
<h3 className="text-xs sm:text-sm font-mono font-bold uppercase tracking-widest text-slate-700">
<h3 className="text-xs sm:text-sm font-mono font-bold uppercase tracking-widest text-slate-800 text-3d-chiseled preserve-3d">
Live Transformations by CRE Neural Engine
</h3>
</div>
@@ -87,12 +87,12 @@ export function TransformationReelSection() {
</div>
{/* Horizontal scrolling showcase */}
<div className="flex gap-5 sm:gap-6 overflow-x-auto pb-4 px-4 sm:px-8 no-scrollbar scroll-smooth">
<div className="flex gap-5 sm:gap-6 overflow-x-auto pb-4 px-4 sm:px-8 no-scrollbar scroll-smooth preserve-3d">
{transformations.map((item, idx) => (
<Link
key={idx}
href={`/tools/${item.toolSlug}`}
className="group shrink-0 w-64 sm:w-72 bg-white rounded-2xl p-3.5 border border-slate-900/[0.08] shadow-sm hover:shadow-md hover:border-blue-400 hover:-translate-y-1 transition-all duration-300"
className="group shrink-0 w-64 sm:w-72 bg-white/95 backdrop-blur-sm rounded-2xl p-3.5 border border-slate-900/[0.08] shadow-sm hover:shadow-cinematic-hover hover:border-blue-400 hover:-translate-y-1.5 transition-all duration-300 preserve-3d"
>
{/* Visual side-by-side thumbnail */}
<div className="relative aspect-[16/10] rounded-xl overflow-hidden mb-3 bg-slate-950 border border-slate-200">
@@ -114,19 +114,19 @@ export function TransformationReelSection() {
</div>
</div>
<div className="space-y-1">
<div className="space-y-1 preserve-3d">
<div className="flex items-center justify-between">
<span className="text-[10px] font-mono uppercase tracking-wider text-blue-600 font-bold">
<span className="badge-3d text-[10px] font-mono uppercase tracking-wider text-blue-600 font-bold px-2 py-0.5 rounded-full bg-blue-50/80 border border-blue-200/60">
{item.category}
</span>
<span className="text-[10px] font-mono text-slate-400 group-hover:text-blue-600 transition-colors font-medium">
Try Free →
</span>
</div>
<p className="font-display font-bold text-sm text-slate-900 group-hover:text-blue-600 transition-colors truncate">
<h4 className="font-display font-bold text-sm text-slate-900 group-hover:text-blue-600 transition-colors truncate preserve-3d text-3d-chiseled" style={{ transform: 'translateZ(14px)' }}>
{item.toolName}
</p>
<p className="text-[11px] font-mono text-slate-500 truncate">
</h4>
<p className="text-[11px] font-mono text-slate-500 truncate" style={{ transform: 'translateZ(8px)' }}>
{item.tag}
</p>
</div>
@@ -69,12 +69,12 @@ export function VerticalToolStackSection({ context }: VerticalToolStackProps) {
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
{/* Section Header: Centered & Balanced */}
<div className="text-center max-w-3xl mx-auto mb-12 sm:mb-16">
<div className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700 mb-4 shadow-sm">
<div className="badge-3d inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700 mb-4 shadow-sm">
<Zap className="w-3.5 h-3.5 text-blue-600" />
<span>THE CREATIVE STUDIO SUITE</span>
</div>
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight mb-5">
Advanced <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-purple-600">Vision Tools</span>
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight mb-5 text-3d-chiseled">
Advanced <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-purple-600 text-3d-gradient">Vision Tools</span>
</h2>
<p className="text-base sm:text-lg text-slate-600 leading-relaxed font-normal">
Precision deep learning models organized by creative discipline. Test sub-millimeter skin pore retouching, fine hair alpha matting, and 4K super-resolution directly in your browser.
@@ -204,7 +204,7 @@ export function VerticalToolStackSection({ context }: VerticalToolStackProps) {
<div className="grid grid-cols-1 md:grid-cols-12 gap-8 lg:gap-10 items-center">
{/* Left Details Column */}
<div className="md:col-span-6 space-y-4">
<h4 className="text-2xl sm:text-3xl font-display font-bold text-slate-900 group-hover:text-blue-600 transition-colors">
<h4 className="text-2xl sm:text-3xl font-display font-bold text-slate-900 group-hover:text-blue-600 transition-colors text-3d-chiseled">
{resolveLocalised(tool.name, locale)}
</h4>
<p className="text-xs sm:text-sm text-slate-600 leading-relaxed font-normal">
@@ -32,13 +32,13 @@ export function WorkflowVisualizerSection() {
return (
<section className="py-24 sm:py-32 bg-[#F5F2EB] border-t border-slate-900/[0.08] relative overflow-hidden">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
<div className="text-center max-w-3xl mx-auto mb-16 sm:mb-20 space-y-4">
<div className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700">
<div className="text-center max-w-3xl mx-auto mb-16 sm:mb-20 space-y-4 preserve-3d">
<div className="badge-3d inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700">
<Zap className="w-3.5 h-3.5 text-blue-600" />
<span>HIGH-SPEED ZERO-STORAGE PIPELINE</span>
</div>
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight">
How <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 to-indigo-600">CRE Innovations</span> Works
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight text-3d-chiseled">
How <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 to-indigo-600 text-3d-gradient">CRE Innovations</span> Works
</h2>
<p className="text-base sm:text-lg text-slate-600 max-w-2xl mx-auto">
A frictionless pipeline engineered for microsecond latency, cryptographic user privacy, and fluid mobile transition.
@@ -55,7 +55,7 @@ export function WorkflowVisualizerSection() {
>
<div>
<div className="flex items-center justify-between mb-6">
<span className="text-4xl font-mono font-black text-slate-200 group-hover:text-blue-200 transition-colors">
<span className="text-4xl font-mono font-black text-slate-300 group-hover:text-blue-400 transition-colors stat-value">
{st.num}
</span>
<div className={`w-12 h-12 rounded-2xl flex items-center justify-center bg-gradient-to-br ${st.gradient} border shadow-sm`}>
@@ -63,7 +63,7 @@ export function WorkflowVisualizerSection() {
</div>
</div>
<h3 className="text-xl font-display font-bold text-slate-900 mb-2 group-hover:text-blue-600 transition-colors">
<h3 className="text-xl font-display font-bold text-slate-900 mb-2 group-hover:text-blue-600 transition-colors text-3d-chiseled">
{st.title}
</h3>
<p className="text-xs sm:text-sm text-slate-600 leading-relaxed mb-6 font-normal">
+2 -2
View File
@@ -81,10 +81,10 @@ export function BrandLogo({
{showWordmark && (
<div className="flex flex-col">
<div className="flex items-center tracking-tight leading-none">
<span className={`font-display font-black text-transparent bg-clip-text bg-gradient-to-r from-blue-700 to-indigo-600 tracking-[0.1em] ${iconDimensions.textScale}`}>
<span className={`font-display font-black text-transparent bg-clip-text bg-gradient-to-r from-blue-700 to-indigo-600 tracking-[0.1em] text-3d-gradient ${iconDimensions.textScale}`}>
CRE
</span>
<span className={`font-display font-bold text-slate-900 tracking-[0.16em] ml-1.5 ${iconDimensions.textScale}`}>
<span className={`font-display font-bold text-slate-900 tracking-[0.16em] ml-1.5 text-3d-chiseled ${iconDimensions.textScale}`}>
INNOVATIONS
</span>
</div>
+144
View File
@@ -0,0 +1,144 @@
'use client';
import React, { useEffect } from 'react';
export function Cinematic3DTextEngine() {
useEffect(() => {
// Check prefers-reduced-motion
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
let rafId: number;
let mouseX = 0;
let mouseY = 0;
let targetMouseX = 0;
let targetMouseY = 0;
let currentMouseX = 0;
let currentMouseY = 0;
let lastScrollY = window.scrollY || 0;
let targetScrollPitch = 0;
let currentScrollPitch = 0;
let clock = 0;
const handleMouseMove = (e: MouseEvent) => {
const vw = window.innerWidth;
const vh = window.innerHeight;
targetMouseX = (e.clientX / vw) * 2 - 1;
targetMouseY = (e.clientY / vh) * 2 - 1;
};
const handleScroll = () => {
const sy = window.scrollY || 0;
const delta = sy - lastScrollY;
lastScrollY = sy;
// Scroll velocity pitch tilt (leans on scroll)
targetScrollPitch = Math.max(Math.min(delta * 0.2, 8), -8);
};
window.addEventListener('mousemove', handleMouseMove, { passive: true });
window.addEventListener('scroll', handleScroll, { passive: true });
// Selector targeting all headings, display titles, stats, badges, and card titles across the whole website
const selector = [
'h1:not([data-no3d])',
'h2:not([data-no3d])',
'h3:not([data-no3d])',
'h4:not([data-no3d])',
'.font-display:not([data-no3d])',
'.stat-value:not([data-no3d])',
'.badge-3d:not([data-no3d])',
'[data-3d-text]',
].join(', ');
const tick = () => {
clock += 0.022;
// Inertial smoothing lerps
currentMouseX += (targetMouseX - currentMouseX) * 0.075;
currentMouseY += (targetMouseY - currentMouseY) * 0.075;
currentScrollPitch += (targetScrollPitch - currentScrollPitch) * 0.1;
targetScrollPitch *= 0.88; // Damping decay
// Update root CSS variables for global CSS animation pairing
document.documentElement.style.setProperty('--3d-mouse-x', currentMouseX.toFixed(3));
document.documentElement.style.setProperty('--3d-mouse-y', currentMouseY.toFixed(3));
document.documentElement.style.setProperty('--3d-scroll-pitch', `${currentScrollPitch.toFixed(2)}deg`);
const elements = document.querySelectorAll<HTMLElement>(selector);
const vh = window.innerHeight;
const vw = window.innerWidth;
elements.forEach((el, index) => {
// Skip canvas or explicitly opted-out elements
if (el.closest('canvas') || el.closest('[data-no3d-container]')) return;
const rect = el.getBoundingClientRect();
// Skip elements far outside viewport for performance
if (rect.bottom < -200 || rect.top > vh + 200) return;
// Ensure element can receive 3D transform (inline elements cannot be transformed)
const computedDisplay = window.getComputedStyle(el).display;
if (computedDisplay === 'inline') {
el.style.display = 'inline-block';
}
const elCenterX = rect.left + rect.width / 2;
const elCenterY = rect.top + rect.height / 2;
// Parallax coordinates relative to viewport center
const dx = (elCenterX - vw / 2) / (vw / 2);
const dy = (elCenterY - vh / 2) / (vh / 2);
// Individual organic phase offset for each element
const phase = index * 0.45;
const waveX = Math.sin(clock * 1.3 + phase) * 3.2;
const waveY = Math.cos(clock * 1.0 + phase) * 3.8;
const waveZ = Math.sin(clock * 1.6 + phase) * 6;
// Hierarchical depth based on tag importance
const tagName = el.tagName.toLowerCase();
let baseZ = 16;
let rotMultiplier = 1;
if (tagName === 'h1') {
baseZ = 30;
rotMultiplier = 1.3;
} else if (tagName === 'h2') {
baseZ = 24;
rotMultiplier = 1.15;
} else if (tagName === 'h3') {
baseZ = 18;
rotMultiplier = 1.0;
} else if (el.classList.contains('stat-value')) {
baseZ = 26;
rotMultiplier = 1.2;
} else if (tagName === 'h4') {
baseZ = 14;
rotMultiplier = 0.9;
}
// Calculate 3D perspective pitch, yaw, and translation
const rotX = (-(currentMouseY * 6 + dy * 3.5) + currentScrollPitch + waveX) * rotMultiplier;
const rotY = (currentMouseX * 7 + dx * 4 + waveY) * rotMultiplier;
const transZ = Math.max(baseZ + waveZ - Math.hypot(dx, dy) * 4, 6);
el.style.transform = `perspective(950px) rotateX(${rotX.toFixed(2)}deg) rotateY(${rotY.toFixed(2)}deg) translateZ(${transZ.toFixed(1)}px)`;
el.style.transformStyle = 'preserve-3d';
el.style.willChange = 'transform';
});
rafId = requestAnimationFrame(tick);
};
rafId = requestAnimationFrame(tick);
return () => {
cancelAnimationFrame(rafId);
window.removeEventListener('mousemove', handleMouseMove);
window.removeEventListener('scroll', handleScroll);
};
}, []);
return null;
}
+58 -29
View File
@@ -1,6 +1,6 @@
'use client';
import React, { useState, useRef, useEffect } from 'react';
import React, { useRef, useEffect } from 'react';
interface Kinetic3DTextProps {
primaryText: string;
@@ -15,37 +15,64 @@ export function Kinetic3DText({
subtitle,
className = '',
}: Kinetic3DTextProps) {
const [tilt, setTilt] = useState({ rx: 0, ry: 0, active: false });
const containerRef = useRef<HTMLDivElement>(null);
const headlineRef = useRef<HTMLHeadingElement>(null);
const shadowRef = useRef<HTMLDivElement>(null);
const subtitleRef = useRef<HTMLParagraphElement>(null);
useEffect(() => {
// Check prefers-reduced-motion
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
let rafId: number;
let targetRx = 0;
let targetRy = 0;
let currentRx = 0;
let currentRy = 0;
let clock = 0;
const handleMouseMove = (e: MouseEvent) => {
if (!containerRef.current) return;
const rect = containerRef.current.getBoundingClientRect();
const centerX = rect.left + rect.width / 2;
const centerY = rect.top + rect.height / 2;
const vw = window.innerWidth;
const vh = window.innerHeight;
// Normalized coordinates -1 to +1 centered on screen
const nx = (e.clientX / vw) * 2 - 1;
const ny = (e.clientY / vh) * 2 - 1;
// Normalized coordinates -1 to +1
const nx = (e.clientX - centerX) / (window.innerWidth * 0.5);
const ny = (e.clientY - centerY) / (window.innerHeight * 0.5);
targetRy = Math.max(Math.min(nx * 10, 12), -12);
targetRx = Math.max(Math.min(-ny * 8, 10), -10);
targetRy = nx * 14; // Horizontal tilt up to 14 deg
targetRx = -ny * 12; // Vertical tilt up to 12 deg
};
const updateLoop = () => {
// Smooth inertial lerp
currentRx += (targetRx - currentRx) * 0.1;
currentRy += (targetRy - currentRy) * 0.1;
clock += 0.025;
// Inertial damping lerp for mouse response
currentRx += (targetRx - currentRx) * 0.085;
currentRy += (targetRy - currentRy) * 0.085;
// Autonomous continuous 3D breathing wave (always alive)
const waveRx = Math.sin(clock * 1.4) * 3.5;
const waveRy = Math.cos(clock * 1.1) * 4.2;
const waveZ = Math.sin(clock * 1.8) * 8;
const totalRx = currentRx + waveRx;
const totalRy = currentRy + waveRy;
if (containerRef.current) {
containerRef.current.style.transform = `rotateX(${currentRx.toFixed(2)}deg) rotateY(${currentRy.toFixed(2)}deg)`;
containerRef.current.style.transform = `perspective(1100px) rotateX(${totalRx.toFixed(2)}deg) rotateY(${totalRy.toFixed(2)}deg) translateZ(${waveZ.toFixed(1)}px)`;
}
if (headlineRef.current) {
// Multi-tier parallax elevation
headlineRef.current.style.transform = `translateZ(42px) rotateX(${(totalRx * 0.3).toFixed(2)}deg)`;
}
if (shadowRef.current) {
// Holographic blur shadow projected behind
shadowRef.current.style.transform = `translateZ(-28px) translate(${(totalRy * 1.8).toFixed(1)}px, ${(totalRx * 1.8).toFixed(1)}px) scale(1.05)`;
}
if (subtitleRef.current) {
subtitleRef.current.style.transform = `translateZ(24px) rotateX(${(totalRx * 0.2).toFixed(2)}deg)`;
}
rafId = requestAnimationFrame(updateLoop);
@@ -65,39 +92,41 @@ export function Kinetic3DText({
{/* 3D Stereoscopic Kinetic Text Stage */}
<div
ref={containerRef}
className="preserve-3d transition-transform duration-75 ease-out will-change-transform"
className="preserve-3d will-change-transform"
>
{/* Layer 1: Ambient 3D Text Holographic Depth Shadow */}
{/* Layer 1: Ambient 3D Text Holographic Depth Reflection */}
<div
className="absolute inset-0 select-none pointer-events-none opacity-20 blur-md transform translate-z-[-20px] scale-[1.03]"
ref={shadowRef}
className="absolute inset-0 select-none pointer-events-none opacity-25 blur-lg will-change-transform"
aria-hidden="true"
>
<span className="text-4xl sm:text-5xl lg:text-6xl xl:text-7xl font-display font-black text-blue-700 leading-[1.08] tracking-tight block">
<span className="text-4xl sm:text-5xl lg:text-6xl xl:text-7xl font-display font-black text-blue-600 leading-[1.08] tracking-tight block">
{primaryText} <br className="hidden sm:inline" />
{highlightText}
</span>
</div>
{/* Layer 2: Main Floating 3D Headline */}
{/* Layer 2: Main Floating 3D Headline with Chiseled Extrusion */}
<h1
className="text-4xl sm:text-5xl lg:text-6xl xl:text-7xl font-display font-black text-slate-900 tracking-tight leading-[1.08] relative z-10 preserve-3d"
style={{ transform: 'translateZ(35px)' }}
ref={headlineRef}
className="text-4xl sm:text-5xl lg:text-6xl xl:text-7xl font-display font-black text-slate-900 tracking-tight leading-[1.08] relative z-10 preserve-3d will-change-transform text-3d-chiseled"
>
<span>{primaryText}</span> <br className="hidden sm:inline" />
<span className="inline-block preserve-3d">{primaryText}</span>{' '}
<br className="hidden sm:inline" />
{highlightText && (
<span className="relative inline-block mt-1 sm:mt-0 preserve-3d">
<span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600 drop-shadow-[0_4px_12px_rgba(37,99,235,0.25)]">
<span className="relative inline-block mt-2 sm:mt-1 preserve-3d">
<span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600 text-3d-gradient inline-block">
{highlightText}
</span>
</span>
)}
</h1>
{/* Layer 3: Elevated Subtitle */}
{/* Layer 3: Elevated 3D Subtitle */}
{subtitle && (
<p
className="mt-6 text-base sm:text-lg lg:text-xl text-slate-600 leading-relaxed max-w-2xl mx-auto font-normal preserve-3d"
style={{ transform: 'translateZ(20px)' }}
ref={subtitleRef}
className="mt-6 text-base sm:text-lg lg:text-xl text-slate-600 leading-relaxed max-w-2xl mx-auto font-normal preserve-3d will-change-transform"
>
{subtitle}
</p>