feat(3d): transform website into 3d cinematic graphics with horizontal scroll and holographic comparison in light luxury theme
This commit is contained in:
@@ -0,0 +1,91 @@
|
|||||||
|
# 3D Cinematic Graphics Overhaul (Enigma Cult Reference - Light Luxury Theme)
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** Transform the website into an immersive 3D cinematic experience inspired by `enigmascult.com` (scroll-driven horizontal pinning, 3D holographic image comparison, 3D perspective spatial depth), while preserving an airy, high-fashion **Light Shade Theme** (creamy sandstone `#FAF8F5`, metallic champagne gold `#C5A880`, titanium glass, and studio sapphire accents).
|
||||||
|
|
||||||
|
**Architecture:**
|
||||||
|
- **Cinematic 3D Comparison Viewport (`Cinematic3DComparison.tsx`)**: Replaces flat before/after containers with a 3D perspective card (`perspective(1400px)`) that reacts with real-time inertial 3D tilt to cursor/touch coordinates, floating 3D telemetry tags (`translateZ(40px)`), an illuminated holographic laser split line with champagne-sapphire edge caustics, and dynamic specular glare.
|
||||||
|
- **Scroll-Driven Horizontal Motion Gallery (`CinematicHorizontalScrollSection.tsx`)**: Pinned vertical-to-horizontal scrolling section where the viewport locks and translates a filmstrip of flagship models horizontally with 3D perspective card rotations (`rotateY`, `scale`, `translateZ`) and index counters (`01 / 03`).
|
||||||
|
- **3D Cinematic Hero & Spatial Atmosphere**: Integrates Three.js kinetic neural prism with light-mode refractions into the hero alongside luxury editorial display typography and metallic badges.
|
||||||
|
- **Light Luxury Color Scheme & CSS Utilities**: Added to `globals.css` (sandstone `#FAF8F5`, metallic champagne `#C5A880`, 3D perspective, `preserve-3d`, deep ambient drop shadows).
|
||||||
|
|
||||||
|
**Tech Stack:** Next.js 14, React 18, Three.js, Lenis Smooth Scroll, Tailwind CSS, Lucide React.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: Light Luxury 3D Perspective CSS Utilities & Theme Colors
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `src/app/globals.css`
|
||||||
|
- Test: Build verification (`npm run build`)
|
||||||
|
|
||||||
|
**Steps:**
|
||||||
|
- [ ] Step 1.1: Add 3D perspective utilities to `globals.css` (`perspective-1000`, `perspective-1400`, `preserve-3d`, `backface-hidden`).
|
||||||
|
- [ ] Step 1.2: Add light-mode luxury color variables and glass tokens (`--color-champagne: #C5A880`, `--color-sandstone: #FAF8F5`, `--shadow-cinematic-3d`).
|
||||||
|
- [ ] Step 1.3: Add holographic laser line and caustic animation keyframes (`@keyframes laser-glow`, `@keyframes holographic-scan`).
|
||||||
|
- [ ] Step 1.4: Build and verify CSS compile.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 2: Build `Cinematic3DComparison.tsx` (Complete 3D Image Comparison Viewport)
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `src/components/ui/Cinematic3DComparison.tsx`
|
||||||
|
- Modify: `src/components/ui/BeforeAfterSlider.tsx`
|
||||||
|
- Test: Verify in browser with interactive dragging, cursor 3D tilting, and holographic laser line.
|
||||||
|
|
||||||
|
**Steps:**
|
||||||
|
- [ ] Step 2.1: Implement 3D perspective wrapper with mouse/touch inertial tilt (`rotateX`, `rotateY`, `translateZ`).
|
||||||
|
- [ ] Step 2.2: Implement dynamic specular glare overlay that follows mouse coordinates.
|
||||||
|
- [ ] Step 2.3: Build holographic split divider with champagne-gold and sapphire laser illumination and 3D tactile circular handle.
|
||||||
|
- [ ] Step 2.4: Add floating 3D telemetry tags at `translateZ(30px)` (`[ DELTA MAP: ACTIVE ]`, `[ 4K LOSSLESS ]`).
|
||||||
|
- [ ] Step 2.5: Integrate into `BeforeAfterSlider.tsx` so existing before/after widgets gain the 3D cinematic capabilities.
|
||||||
|
- [ ] Step 2.6: Verify in Puppeteer.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 3: Build `CinematicHorizontalScrollSection.tsx` (Scroll-Driven Horizontal Motion Gallery)
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `src/components/sections/CinematicHorizontalScrollSection.tsx`
|
||||||
|
- Modify: `src/components/sections/SectionRenderer.tsx`
|
||||||
|
- Modify: `content/pages/home.json`
|
||||||
|
- Test: Verify pinned scrolling and horizontal translation in browser.
|
||||||
|
|
||||||
|
**Steps:**
|
||||||
|
- [ ] Step 3.1: Build sticky pinned container (`h-[320vh]`, `sticky top-0 h-screen overflow-hidden`) that calculates vertical scroll progress ($0 \to 1$).
|
||||||
|
- [ ] Step 3.2: Translate horizontal track with smooth GPU transform `translate3d(-${x}px, 0, 0)` with 3D perspective rotation on cards based on viewport distance.
|
||||||
|
- [ ] Step 3.3: Render 3 flagship cards with luxury editorial metadata (`INDEX // 01`, `INDEX // 02`, `INDEX // 03`, technical specs, and embedded 3D image comparison).
|
||||||
|
- [ ] Step 3.4: Add progress bar at the bottom with luxury gold-to-sapphire indicator and mobile touch-swipe fallback.
|
||||||
|
- [ ] Step 3.5: Register section in `SectionRenderer.tsx` and configure in `home.json`.
|
||||||
|
- [ ] Step 3.6: Verify in Puppeteer on desktop and mobile viewports.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 4: Upgrade Hero Section with 3D Kinetic Neural Prism & Luxury Editorial Layout
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `src/components/sections/HeroSection.tsx`
|
||||||
|
- Modify: `src/components/3d/Hero3DCanvas.tsx`
|
||||||
|
- Test: Verify 3D canvas rendering with luxury light-mode refractions, zero errors, and clean responsive layout.
|
||||||
|
|
||||||
|
**Steps:**
|
||||||
|
- [ ] Step 4.1: Tune `Hero3DCanvas.tsx` crystal materials for light luxury aesthetic (translucent sapphire-champagne refraction with high transmission and gold edge lines).
|
||||||
|
- [ ] Step 4.2: Integrate `Hero3DCanvas` into `HeroSection.tsx` behind the hero title with depth layering.
|
||||||
|
- [ ] Step 4.3: Add Enigma-style metadata chips (`NEURAL VISION SUITE // 2026`, `COORDINATES // STUDIO CORE`).
|
||||||
|
- [ ] Step 4.4: Verify in Puppeteer.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 5: Production Build, Server Verification, Frame Rate Benchmarks & Git Commit
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- All modified components
|
||||||
|
- Test: `npm run build`, route verification script, Puppeteer frame rate benchmark (60/120 FPS).
|
||||||
|
|
||||||
|
**Steps:**
|
||||||
|
- [ ] Step 5.1: Run `npm run build` and confirm 0 errors.
|
||||||
|
- [ ] Step 5.2: Restart production server daemon and run route verification script (`verify_changes.py`).
|
||||||
|
- [ ] Step 5.3: Benchmark scroll frame times in Puppeteer and take screenshots of the 3D cinematic comparison and horizontal scroll gallery.
|
||||||
|
- [ ] Step 5.4: Git commit all changes cleanly.
|
||||||
@@ -257,3 +257,62 @@
|
|||||||
animation: float-medium 7.5s ease-in-out infinite;
|
animation: float-medium 7.5s ease-in-out infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 3D Cinematic Perspective Utilities (Enigma Cult Reference) */
|
||||||
|
.perspective-800 {
|
||||||
|
perspective: 800px;
|
||||||
|
}
|
||||||
|
.perspective-1000 {
|
||||||
|
perspective: 1000px;
|
||||||
|
}
|
||||||
|
.perspective-1400 {
|
||||||
|
perspective: 1400px;
|
||||||
|
}
|
||||||
|
.preserve-3d {
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
}
|
||||||
|
.backface-hidden {
|
||||||
|
backface-visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Luxury 3D Holographic Split Line & Caustics */
|
||||||
|
@keyframes holographic-laser-pulse {
|
||||||
|
0%, 100% {
|
||||||
|
box-shadow:
|
||||||
|
0 0 10px rgba(37, 99, 235, 0.7),
|
||||||
|
0 0 25px rgba(197, 168, 128, 0.4),
|
||||||
|
inset 0 0 8px rgba(255, 255, 255, 0.8);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
box-shadow:
|
||||||
|
0 0 18px rgba(37, 99, 235, 0.95),
|
||||||
|
0 0 40px rgba(197, 168, 128, 0.65),
|
||||||
|
inset 0 0 12px rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.holographic-laser-split {
|
||||||
|
animation: holographic-laser-pulse 2.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Light Luxury Cinematic 3D Card Shadows */
|
||||||
|
.shadow-cinematic-3d {
|
||||||
|
box-shadow:
|
||||||
|
0 30px 60px -15px rgba(15, 23, 42, 0.08),
|
||||||
|
0 10px 25px -5px rgba(15, 23, 42, 0.04),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadow-cinematic-hover {
|
||||||
|
box-shadow:
|
||||||
|
0 40px 80px -20px rgba(15, 23, 42, 0.12),
|
||||||
|
0 16px 32px -8px rgba(37, 99, 235, 0.08),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enigma Editorial Typography Accent Gradients */
|
||||||
|
.text-gradient-champagne {
|
||||||
|
background: linear-gradient(135deg, #1E293B 20%, #B89058 70%, #9B6B43 100%);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,38 +71,38 @@ export function Hero3DCanvas({ className = '' }: Hero3DCanvasProps) {
|
|||||||
// 1. Outer Translucent Diamond Crystal Prism (Octahedron)
|
// 1. Outer Translucent Diamond Crystal Prism (Octahedron)
|
||||||
crystalGeo = new THREE.OctahedronGeometry(1.8, 0);
|
crystalGeo = new THREE.OctahedronGeometry(1.8, 0);
|
||||||
crystalMat = new THREE.MeshPhysicalMaterial({
|
crystalMat = new THREE.MeshPhysicalMaterial({
|
||||||
color: 0x3b82f6, // Electric Blue
|
color: 0x2563eb, // Studio Sapphire
|
||||||
roughness: 0.1,
|
roughness: 0.08,
|
||||||
metalness: 0.1,
|
metalness: 0.15,
|
||||||
transmission: 0.7,
|
transmission: 0.85,
|
||||||
opacity: 0.65,
|
opacity: 0.7,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
emissive: 0x1d4ed8,
|
emissive: 0x1d4ed8,
|
||||||
emissiveIntensity: 0.2,
|
emissiveIntensity: 0.25,
|
||||||
});
|
});
|
||||||
const crystalMesh = new THREE.Mesh(crystalGeo, crystalMat);
|
const crystalMesh = new THREE.Mesh(crystalGeo, crystalMat);
|
||||||
rootGroup.add(crystalMesh);
|
rootGroup.add(crystalMesh);
|
||||||
|
|
||||||
// Subtle Glowing Edge Highlights on Crystal
|
// Subtle Champagne Glowing Edge Highlights on Crystal
|
||||||
edgesGeo = new THREE.EdgesGeometry(crystalGeo);
|
edgesGeo = new THREE.EdgesGeometry(crystalGeo);
|
||||||
edgesMat = new THREE.LineBasicMaterial({
|
edgesMat = new THREE.LineBasicMaterial({
|
||||||
color: 0x60a5fa,
|
color: 0xc5a880, // Champagne Gold
|
||||||
transparent: true,
|
transparent: true,
|
||||||
opacity: 0.8,
|
opacity: 0.85,
|
||||||
});
|
});
|
||||||
const edgesLines = new THREE.LineSegments(edgesGeo, edgesMat);
|
const edgesLines = new THREE.LineSegments(edgesGeo, edgesMat);
|
||||||
rootGroup.add(edgesLines);
|
rootGroup.add(edgesLines);
|
||||||
|
|
||||||
// 2. Inner Nested Core Prism (Counter-rotating)
|
// 2. Inner Nested Core Prism (Counter-rotating Gold Core)
|
||||||
innerGeo = new THREE.OctahedronGeometry(1.0, 0);
|
innerGeo = new THREE.OctahedronGeometry(1.0, 0);
|
||||||
innerMat = new THREE.MeshPhysicalMaterial({
|
innerMat = new THREE.MeshPhysicalMaterial({
|
||||||
color: 0x6366f1, // Indigo
|
color: 0xd4af37, // Metallic Gold
|
||||||
roughness: 0.2,
|
roughness: 0.2,
|
||||||
metalness: 0.8,
|
metalness: 0.85,
|
||||||
emissive: 0x4338ca,
|
emissive: 0xb45309,
|
||||||
emissiveIntensity: 0.5,
|
emissiveIntensity: 0.45,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
opacity: 0.8,
|
opacity: 0.85,
|
||||||
});
|
});
|
||||||
const innerMesh = new THREE.Mesh(innerGeo, innerMat);
|
const innerMesh = new THREE.Mesh(innerGeo, innerMat);
|
||||||
rootGroup.add(innerMesh);
|
rootGroup.add(innerMesh);
|
||||||
@@ -112,10 +112,10 @@ export function Hero3DCanvas({ className = '' }: Hero3DCanvasProps) {
|
|||||||
dotGeo = new THREE.BufferGeometry();
|
dotGeo = new THREE.BufferGeometry();
|
||||||
dotGeo.setAttribute('position', vertexPositions);
|
dotGeo.setAttribute('position', vertexPositions);
|
||||||
dotMat = new THREE.PointsMaterial({
|
dotMat = new THREE.PointsMaterial({
|
||||||
color: 0x93c5fd,
|
color: 0xfef3c7,
|
||||||
size: 0.14,
|
size: 0.14,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
opacity: 0.9,
|
opacity: 0.95,
|
||||||
blending: THREE.AdditiveBlending,
|
blending: THREE.AdditiveBlending,
|
||||||
});
|
});
|
||||||
const vertexPoints = new THREE.Points(dotGeo, dotMat);
|
const vertexPoints = new THREE.Points(dotGeo, dotMat);
|
||||||
@@ -138,24 +138,24 @@ export function Hero3DCanvas({ className = '' }: Hero3DCanvasProps) {
|
|||||||
particlesGeo = new THREE.BufferGeometry();
|
particlesGeo = new THREE.BufferGeometry();
|
||||||
particlesGeo.setAttribute('position', new THREE.BufferAttribute(particlePositions, 3));
|
particlesGeo.setAttribute('position', new THREE.BufferAttribute(particlePositions, 3));
|
||||||
particlesMat = new THREE.PointsMaterial({
|
particlesMat = new THREE.PointsMaterial({
|
||||||
color: 0xa5b4fc,
|
color: 0x93c5fd,
|
||||||
size: 0.08,
|
size: 0.08,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
opacity: 0.7,
|
opacity: 0.75,
|
||||||
blending: THREE.AdditiveBlending,
|
blending: THREE.AdditiveBlending,
|
||||||
});
|
});
|
||||||
const particlesMesh = new THREE.Points(particlesGeo, particlesMat);
|
const particlesMesh = new THREE.Points(particlesGeo, particlesMat);
|
||||||
rootGroup.add(particlesMesh);
|
rootGroup.add(particlesMesh);
|
||||||
|
|
||||||
// Lights
|
// Lights: Ambient + Sapphire Key + Champagne Fill
|
||||||
const ambientLight = new THREE.AmbientLight(0xffffff, 0.9);
|
const ambientLight = new THREE.AmbientLight(0xffffff, 1.1);
|
||||||
scene.add(ambientLight);
|
scene.add(ambientLight);
|
||||||
|
|
||||||
const keyLight = new THREE.PointLight(0x38bdf8, 3, 10);
|
const keyLight = new THREE.PointLight(0x38bdf8, 3.2, 10);
|
||||||
keyLight.position.set(3, 3, 3);
|
keyLight.position.set(3, 3, 3);
|
||||||
scene.add(keyLight);
|
scene.add(keyLight);
|
||||||
|
|
||||||
const fillLight = new THREE.PointLight(0xa855f7, 2, 10);
|
const fillLight = new THREE.PointLight(0xc5a880, 2.8, 10);
|
||||||
fillLight.position.set(-3, -2, 2);
|
fillLight.position.set(-3, -2, 2);
|
||||||
scene.add(fillLight);
|
scene.add(fillLight);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,269 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import React, { useRef, useState, useEffect } from 'react';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import { Sparkles, ArrowRight, Smartphone, Zap, Shield, Layers } from 'lucide-react';
|
||||||
|
import { Cinematic3DComparison } from '@/components/ui/Cinematic3DComparison';
|
||||||
|
|
||||||
|
interface ShowcaseCard {
|
||||||
|
id: string;
|
||||||
|
index: string;
|
||||||
|
category: string;
|
||||||
|
model: string;
|
||||||
|
latency: string;
|
||||||
|
title: string;
|
||||||
|
tagline: string;
|
||||||
|
description: string;
|
||||||
|
toolSlug: string;
|
||||||
|
appSlug: string;
|
||||||
|
appName: string;
|
||||||
|
beforeUrl: string;
|
||||||
|
afterUrl: string;
|
||||||
|
specs: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const showcaseCards: ShowcaseCard[] = [
|
||||||
|
{
|
||||||
|
id: 'matting',
|
||||||
|
index: '01 / 03',
|
||||||
|
category: 'ALPHA MATTING ARCHIVE',
|
||||||
|
model: 'P3M-Net Dual-Stream Alpha',
|
||||||
|
latency: '< 520ms Stream',
|
||||||
|
title: 'Hair-Strand Matting & Alpha Isolation',
|
||||||
|
tagline: 'Sub-pixel edge detection with microscopic flyaway hair preservation.',
|
||||||
|
description: 'Trained on high-resolution studio portraits, P3M-Net isolates individual flyaway hair strands, fur, and translucent fabrics without halo artifacts or jagged edges. Streams transparent alpha PNGs in real-time.',
|
||||||
|
toolSlug: 'background-remover',
|
||||||
|
appSlug: 'bg-cleaner-app',
|
||||||
|
appName: 'Magic Cutout Studio',
|
||||||
|
beforeUrl: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=800&auto=format&fit=crop&q=80',
|
||||||
|
afterUrl: 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=800&auto=format&fit=crop&q=80',
|
||||||
|
specs: ['Sub-pixel flyaway detection', 'Lossless alpha PNG export', 'Zero edge halo bleeding'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'retouch',
|
||||||
|
index: '02 / 03',
|
||||||
|
category: 'DERMAL RESTORATION',
|
||||||
|
model: 'RetouchGAN v2.1 Micro-Pore',
|
||||||
|
latency: '< 380ms Stream',
|
||||||
|
title: 'Sub-Pore Skin Retouching & Blemish Removal',
|
||||||
|
tagline: 'Authentic microscopic texture preservation without plastic smoothing.',
|
||||||
|
description: 'Unlike standard beauty filters that smear your face into plastic, RetouchGAN operates at the dermal level—erasing acne, blemishes, and under-eye redness while reconstructing microscopic skin pore geometry.',
|
||||||
|
toolSlug: 'blemish-remover',
|
||||||
|
appSlug: 'portrait-app',
|
||||||
|
appName: 'Portrait Studio AI',
|
||||||
|
beforeUrl: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=800&auto=format&fit=crop&q=80',
|
||||||
|
afterUrl: 'https://images.unsplash.com/photo-1517841905240-472988babdf9?w=800&auto=format&fit=crop&q=80',
|
||||||
|
specs: ['Microscopic pore geometry', 'Instant scar & redness repair', 'True-to-life dermal tones'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'enhancer',
|
||||||
|
index: '03 / 03',
|
||||||
|
category: '4K SUPER-RESOLUTION',
|
||||||
|
model: 'GFPGAN + RealESRGAN Ultra',
|
||||||
|
latency: '< 460ms Stream',
|
||||||
|
title: '4K Super-Resolution & Facial Deblurring',
|
||||||
|
tagline: 'Transform low-resolution snapshots into crystal-clear 4K portraits.',
|
||||||
|
description: 'Deep neural priors restore authentic iris sharpness, eyelash detail, and facial contours on blurry, out-of-focus, or highly compressed photos, yielding gallery-ready clarity with zero guesswork.',
|
||||||
|
toolSlug: 'photo-enhancer',
|
||||||
|
appSlug: 'photo-enhancer-pro',
|
||||||
|
appName: 'Enhance Ultra AI',
|
||||||
|
beforeUrl: 'https://images.unsplash.com/photo-1544005313-94ddf0286df2?w=800&auto=format&fit=crop&q=80',
|
||||||
|
afterUrl: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=800&auto=format&fit=crop&q=80',
|
||||||
|
specs: ['Iris & eyelash synthesis', '400% lossless super-resolution', 'Studio-grade crispness'],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function CinematicHorizontalScrollSection() {
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const trackRef = useRef<HTMLDivElement>(null);
|
||||||
|
const [scrollProgress, setScrollProgress] = useState(0);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let rafId: number;
|
||||||
|
|
||||||
|
const handleScroll = () => {
|
||||||
|
if (!containerRef.current || !trackRef.current) return;
|
||||||
|
const rect = containerRef.current.getBoundingClientRect();
|
||||||
|
const totalScrollable = containerRef.current.offsetHeight - window.innerHeight;
|
||||||
|
|
||||||
|
if (totalScrollable <= 0) return;
|
||||||
|
|
||||||
|
// Calculate progress 0 to 1
|
||||||
|
const progress = Math.min(Math.max(-rect.top / totalScrollable, 0), 1);
|
||||||
|
setScrollProgress(progress);
|
||||||
|
|
||||||
|
// Translate track horizontally
|
||||||
|
const maxTranslate = trackRef.current.scrollWidth - window.innerWidth;
|
||||||
|
if (maxTranslate > 0) {
|
||||||
|
trackRef.current.style.transform = `translate3d(-${progress * maxTranslate}px, 0, 0)`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onScroll = () => {
|
||||||
|
cancelAnimationFrame(rafId);
|
||||||
|
rafId = requestAnimationFrame(handleScroll);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('scroll', onScroll, { passive: true });
|
||||||
|
window.addEventListener('touchmove', onScroll, { passive: true });
|
||||||
|
window.addEventListener('resize', onScroll, { passive: true });
|
||||||
|
handleScroll();
|
||||||
|
|
||||||
|
let boundLenis: any = null;
|
||||||
|
const bindLenisInterval = setInterval(() => {
|
||||||
|
const lenis = (window as any).lenis;
|
||||||
|
if (lenis && typeof lenis.on === 'function') {
|
||||||
|
boundLenis = lenis;
|
||||||
|
lenis.on('scroll', onScroll);
|
||||||
|
clearInterval(bindLenisInterval);
|
||||||
|
}
|
||||||
|
}, 50);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearInterval(bindLenisInterval);
|
||||||
|
window.removeEventListener('scroll', onScroll);
|
||||||
|
window.removeEventListener('touchmove', onScroll);
|
||||||
|
window.removeEventListener('resize', onScroll);
|
||||||
|
if (boundLenis && typeof boundLenis.off === 'function') {
|
||||||
|
boundLenis.off('scroll', onScroll);
|
||||||
|
}
|
||||||
|
cancelAnimationFrame(rafId);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section
|
||||||
|
id="flagship-models"
|
||||||
|
ref={containerRef}
|
||||||
|
className="relative h-[280vh] sm:h-[340vh] bg-[#FAF8F5] border-t border-slate-900/[0.08]"
|
||||||
|
>
|
||||||
|
{/* Sticky Fullscreen Camera Viewport */}
|
||||||
|
<div className="sticky top-0 h-screen w-full overflow-hidden flex flex-col justify-between py-12 sm:py-16">
|
||||||
|
{/* Background Subtle Ambient Gradients */}
|
||||||
|
<div className="absolute top-1/4 left-1/3 w-[500px] h-[500px] bg-blue-500/[0.03] rounded-full blur-3xl pointer-events-none -z-10" />
|
||||||
|
<div className="absolute bottom-1/4 right-1/4 w-[450px] h-[450px] bg-amber-500/[0.025] rounded-full blur-3xl pointer-events-none -z-10" />
|
||||||
|
|
||||||
|
{/* Section Top Header & Navigation Telemetry */}
|
||||||
|
<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>
|
||||||
|
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-blue-50/80 border border-blue-200/80 text-[11px] font-mono font-semibold text-blue-700 mb-2">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<span className="text-xs font-mono font-bold text-slate-500 uppercase tracking-widest">
|
||||||
|
SCROLL DOWN TO PAN HORIZONTALLY
|
||||||
|
</span>
|
||||||
|
<div className="hidden sm:flex items-center gap-1.5 px-3 py-1 rounded-lg bg-white/70 backdrop-blur-sm border border-slate-900/[0.06] text-xs font-mono font-bold text-slate-700">
|
||||||
|
<span className="w-2 h-2 rounded-full bg-blue-600 animate-ping inline-block" />
|
||||||
|
<span>PROGRESS {Math.round(scrollProgress * 100)}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Horizontal Sliding Filmstrip Track */}
|
||||||
|
<div className="relative w-full my-auto overflow-visible py-4">
|
||||||
|
<div
|
||||||
|
ref={trackRef}
|
||||||
|
className="flex items-center gap-8 sm:gap-14 px-6 sm:px-12 lg:px-20 w-max will-change-transform preserve-3d transition-transform duration-75 ease-out"
|
||||||
|
>
|
||||||
|
{showcaseCards.map((card, idx) => (
|
||||||
|
<div
|
||||||
|
key={card.id}
|
||||||
|
className="w-[85vw] sm:w-[620px] lg:w-[740px] shrink-0 bg-white/90 backdrop-blur-xl rounded-3xl p-5 sm:p-8 border border-slate-900/[0.08] shadow-cinematic-3d hover:shadow-cinematic-hover transition-all duration-300 preserve-3d group"
|
||||||
|
style={{
|
||||||
|
transform: `perspective(1200px) rotateY(${(scrollProgress - idx / (showcaseCards.length - 1)) * -12}deg)`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* Card Top Metadata Bar */}
|
||||||
|
<div className="flex items-center justify-between pb-4 border-b border-slate-900/[0.06] mb-5">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<span className="font-mono text-xs font-black text-blue-700 tracking-wider">
|
||||||
|
{card.index}
|
||||||
|
</span>
|
||||||
|
<span className="h-3 w-px bg-slate-300" />
|
||||||
|
<span className="font-mono text-[10px] sm:text-xs font-bold text-slate-500 uppercase tracking-widest">
|
||||||
|
{card.category}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span className="px-2.5 py-1 rounded-md bg-amber-50 border border-amber-200/60 text-[10px] font-mono font-semibold text-amber-800">
|
||||||
|
{card.latency}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 3D Cinematic Comparison Viewport */}
|
||||||
|
<div className="mb-6 relative z-10">
|
||||||
|
<Cinematic3DComparison
|
||||||
|
beforeUrl={card.beforeUrl}
|
||||||
|
afterUrl={card.afterUrl}
|
||||||
|
beforeLabel="RAW SOURCE"
|
||||||
|
afterLabel={card.model}
|
||||||
|
aspectRatio="aspect-[16/10]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Card Editorial Info */}
|
||||||
|
<div className="space-y-3">
|
||||||
|
<h3 className="text-xl sm:text-2xl font-display font-bold text-slate-900 tracking-tight">
|
||||||
|
{card.title}
|
||||||
|
</h3>
|
||||||
|
<p className="text-sm text-slate-600 leading-relaxed font-normal">
|
||||||
|
{card.description}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{/* Specs Chips */}
|
||||||
|
<div className="flex flex-wrap gap-2 pt-2">
|
||||||
|
{card.specs.map((spec, i) => (
|
||||||
|
<span
|
||||||
|
key={i}
|
||||||
|
className="px-2.5 py-1 rounded-lg bg-slate-100 text-slate-700 text-xs font-mono font-medium border border-slate-200/60"
|
||||||
|
>
|
||||||
|
✓ {spec}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Actions */}
|
||||||
|
<div className="pt-4 flex flex-wrap items-center justify-between gap-3 border-t border-slate-900/[0.06]">
|
||||||
|
<Link
|
||||||
|
href={`/tools/${card.toolSlug}`}
|
||||||
|
className="inline-flex items-center gap-2 text-xs font-bold text-blue-700 hover:text-blue-900 group/link"
|
||||||
|
>
|
||||||
|
<span>Launch Interactive Studio</span>
|
||||||
|
<ArrowRight className="w-3.5 h-3.5 group-hover/link:translate-x-1 transition-transform" />
|
||||||
|
</Link>
|
||||||
|
|
||||||
|
<Link
|
||||||
|
href={`/apps/${card.appSlug}`}
|
||||||
|
className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-slate-900 text-white text-xs font-bold hover:bg-blue-700 transition-colors shadow-sm"
|
||||||
|
>
|
||||||
|
<Smartphone className="w-3.5 h-3.5" />
|
||||||
|
<span>{card.appName}</span>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Section Bottom Progress Indicator Bar */}
|
||||||
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 w-full z-10">
|
||||||
|
<div className="w-full bg-slate-200/80 h-1.5 rounded-full overflow-hidden shadow-inner">
|
||||||
|
<div
|
||||||
|
className="h-full bg-gradient-to-r from-blue-600 via-indigo-600 to-amber-500 rounded-full transition-all duration-100 ease-out"
|
||||||
|
style={{ width: `${Math.max(scrollProgress * 100, 3)}%` }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import { Sparkles, ArrowRight, Smartphone, Layers } from 'lucide-react';
|
|||||||
import { resolveLocalised, ToolItem, AppItem, VariantSpec } from '@/types';
|
import { resolveLocalised, ToolItem, AppItem, VariantSpec } from '@/types';
|
||||||
import { TryItWidget } from './TryItWidget';
|
import { TryItWidget } from './TryItWidget';
|
||||||
import { TiltCard } from '@/components/ui/TiltCard';
|
import { TiltCard } from '@/components/ui/TiltCard';
|
||||||
|
import { Hero3DCanvas } from '@/components/3d/Hero3DCanvas';
|
||||||
|
|
||||||
interface HeroSectionProps {
|
interface HeroSectionProps {
|
||||||
title?: any;
|
title?: any;
|
||||||
@@ -42,23 +43,33 @@ export function HeroSection({
|
|||||||
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-full max-w-7xl h-[450px] bg-gradient-to-b from-blue-500/[0.04] via-indigo-500/[0.03] to-transparent blur-3xl pointer-events-none -z-10" />
|
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-full max-w-7xl h-[450px] bg-gradient-to-b from-blue-500/[0.04] via-indigo-500/[0.03] to-transparent blur-3xl pointer-events-none -z-10" />
|
||||||
|
|
||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
|
||||||
|
{/* 3D Ambient Kinetic Prism Floating Behind Header */}
|
||||||
|
<div className="absolute top-12 left-1/2 -translate-x-1/2 w-[320px] h-[320px] pointer-events-none -z-10 opacity-70 hidden md:block">
|
||||||
|
<Hero3DCanvas className="w-full h-full" />
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Main Hero Header */}
|
{/* Main Hero Header */}
|
||||||
<div className="text-center max-w-4xl mx-auto space-y-7 mb-12 sm:mb-16 relative z-10">
|
<div className="text-center max-w-4xl mx-auto space-y-6 mb-12 sm:mb-16 relative z-10">
|
||||||
{/* Live Core Status Pill */}
|
{/* Live Core Status & Enigma Editorial Metadata */}
|
||||||
{resolvedBadge && (
|
<div className="flex flex-wrap items-center justify-center gap-2.5">
|
||||||
<div className="inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-blue-50 border border-blue-200/80 text-xs font-mono font-semibold text-blue-700 shadow-sm backdrop-blur-sm">
|
{resolvedBadge && (
|
||||||
<span className="relative flex h-2 w-2">
|
<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">
|
||||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-500 opacity-75"></span>
|
<span className="relative flex h-2 w-2">
|
||||||
<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-500 opacity-75"></span>
|
||||||
</span>
|
<span className="relative inline-flex rounded-full h-2 w-2 bg-blue-600"></span>
|
||||||
<span>{resolvedBadge}</span>
|
</span>
|
||||||
|
<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">
|
||||||
|
<span>VOL. 26 // NEURAL STUDIO</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
|
||||||
{/* Main Headline with Editorial Kerning and Fluid Scale */}
|
{/* Main Headline with Editorial Kerning and Fluid Scale */}
|
||||||
<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] max-w-4xl mx-auto">
|
<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] max-w-4xl mx-auto">
|
||||||
Transform Photos with <br className="hidden sm:inline" />
|
Transform Photos with <br className="hidden sm:inline" />
|
||||||
<span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-purple-600">
|
<span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600">
|
||||||
Next-Gen Neural AI
|
Next-Gen Neural AI
|
||||||
</span>
|
</span>
|
||||||
</h1>
|
</h1>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { VisualUseCasesSection } from './VisualUseCasesSection';
|
|||||||
import { WorkflowVisualizerSection } from './WorkflowVisualizerSection';
|
import { WorkflowVisualizerSection } from './WorkflowVisualizerSection';
|
||||||
import { VerticalToolStackSection } from './VerticalToolStackSection';
|
import { VerticalToolStackSection } from './VerticalToolStackSection';
|
||||||
import { MajorToolBannersSection } from './MajorToolBannersSection';
|
import { MajorToolBannersSection } from './MajorToolBannersSection';
|
||||||
|
import { CinematicHorizontalScrollSection } from './CinematicHorizontalScrollSection';
|
||||||
|
|
||||||
interface SectionRendererProps {
|
interface SectionRendererProps {
|
||||||
section: SectionConfig;
|
section: SectionConfig;
|
||||||
@@ -71,7 +72,8 @@ export function SectionRenderer({ section, context }: SectionRendererProps) {
|
|||||||
return <TransformationReelSection />;
|
return <TransformationReelSection />;
|
||||||
|
|
||||||
case 'majorToolBanners':
|
case 'majorToolBanners':
|
||||||
return <MajorToolBannersSection />;
|
case 'cinematicHorizontal':
|
||||||
|
return <CinematicHorizontalScrollSection />;
|
||||||
|
|
||||||
case 'visualUseCases':
|
case 'visualUseCases':
|
||||||
return <VisualUseCasesSection />;
|
return <VisualUseCasesSection />;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React, { useState, useRef, useCallback, useEffect } from 'react';
|
import React from 'react';
|
||||||
import { Eye, Sparkles } from 'lucide-react';
|
import { Cinematic3DComparison } from './Cinematic3DComparison';
|
||||||
|
|
||||||
interface BeforeAfterSliderProps {
|
interface BeforeAfterSliderProps {
|
||||||
beforeUrl: string;
|
beforeUrl: string;
|
||||||
@@ -11,172 +11,29 @@ interface BeforeAfterSliderProps {
|
|||||||
caption?: string;
|
caption?: string;
|
||||||
aspectRatio?: string;
|
aspectRatio?: string;
|
||||||
autoSlide?: boolean;
|
autoSlide?: boolean;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BeforeAfterSlider({
|
export function BeforeAfterSlider({
|
||||||
beforeUrl,
|
beforeUrl,
|
||||||
afterUrl,
|
afterUrl,
|
||||||
beforeLabel = 'Original',
|
beforeLabel,
|
||||||
afterLabel = 'CRE AI Result',
|
afterLabel,
|
||||||
caption,
|
caption,
|
||||||
aspectRatio = 'aspect-[4/3] sm:aspect-[16/10]',
|
aspectRatio = 'aspect-[4/3] sm:aspect-[16/10]',
|
||||||
autoSlide = true,
|
autoSlide = true,
|
||||||
|
className = '',
|
||||||
}: BeforeAfterSliderProps) {
|
}: BeforeAfterSliderProps) {
|
||||||
const [sliderPosition, setSliderPosition] = useState(50);
|
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
|
||||||
const [isUserInteracting, setIsUserInteracting] = useState(false);
|
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
|
||||||
const animFrameRef = useRef<number | null>(null);
|
|
||||||
const resumeTimerRef = useRef<NodeJS.Timeout | null>(null);
|
|
||||||
const startTimeRef = useRef<number>(Date.now());
|
|
||||||
|
|
||||||
// Auto-slide animation loop using RAF
|
|
||||||
useEffect(() => {
|
|
||||||
if (!autoSlide || isDragging || isUserInteracting) {
|
|
||||||
if (animFrameRef.current) cancelAnimationFrame(animFrameRef.current);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const animate = () => {
|
|
||||||
const elapsed = Date.now() - startTimeRef.current;
|
|
||||||
// Smooth sine wave between 24% and 76% (period ~4 seconds)
|
|
||||||
const newPos = 50 + 26 * Math.sin(elapsed * 0.0016);
|
|
||||||
setSliderPosition(newPos);
|
|
||||||
animFrameRef.current = requestAnimationFrame(animate);
|
|
||||||
};
|
|
||||||
|
|
||||||
animFrameRef.current = requestAnimationFrame(animate);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
if (animFrameRef.current) cancelAnimationFrame(animFrameRef.current);
|
|
||||||
};
|
|
||||||
}, [autoSlide, isDragging, isUserInteracting]);
|
|
||||||
|
|
||||||
const handleMove = useCallback((clientX: number) => {
|
|
||||||
if (!containerRef.current) return;
|
|
||||||
const rect = containerRef.current.getBoundingClientRect();
|
|
||||||
const x = Math.max(0, Math.min(clientX - rect.left, rect.width));
|
|
||||||
const percent = Math.max(0, Math.min(100, (x / rect.width) * 100));
|
|
||||||
setSliderPosition(percent);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleTouchMove = useCallback((e: TouchEvent) => {
|
|
||||||
if (!isDragging) return;
|
|
||||||
handleMove(e.touches[0].clientX);
|
|
||||||
}, [isDragging, handleMove]);
|
|
||||||
|
|
||||||
const handleMouseMove = useCallback((e: MouseEvent) => {
|
|
||||||
if (!isDragging) return;
|
|
||||||
handleMove(e.clientX);
|
|
||||||
}, [isDragging, handleMove]);
|
|
||||||
|
|
||||||
const handleMouseUp = useCallback(() => {
|
|
||||||
setIsDragging(false);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isDragging) {
|
|
||||||
window.addEventListener('mousemove', handleMouseMove, { passive: true });
|
|
||||||
window.addEventListener('mouseup', handleMouseUp);
|
|
||||||
window.addEventListener('touchmove', handleTouchMove, { passive: true });
|
|
||||||
window.addEventListener('touchend', handleMouseUp);
|
|
||||||
}
|
|
||||||
return () => {
|
|
||||||
window.removeEventListener('mousemove', handleMouseMove);
|
|
||||||
window.removeEventListener('mouseup', handleMouseUp);
|
|
||||||
window.removeEventListener('touchmove', handleTouchMove);
|
|
||||||
window.removeEventListener('touchend', handleMouseUp);
|
|
||||||
};
|
|
||||||
}, [isDragging, handleMouseMove, handleMouseUp, handleTouchMove]);
|
|
||||||
|
|
||||||
const handleMouseEnter = () => {
|
|
||||||
setIsUserInteracting(true);
|
|
||||||
if (resumeTimerRef.current) clearTimeout(resumeTimerRef.current);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleMouseLeave = () => {
|
|
||||||
if (resumeTimerRef.current) clearTimeout(resumeTimerRef.current);
|
|
||||||
resumeTimerRef.current = setTimeout(() => {
|
|
||||||
setIsUserInteracting(false);
|
|
||||||
startTimeRef.current = Date.now();
|
|
||||||
}, 2500);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<Cinematic3DComparison
|
||||||
<div
|
beforeUrl={beforeUrl}
|
||||||
ref={containerRef}
|
afterUrl={afterUrl}
|
||||||
onMouseEnter={handleMouseEnter}
|
beforeLabel={beforeLabel}
|
||||||
onMouseLeave={handleMouseLeave}
|
afterLabel={afterLabel}
|
||||||
onMouseDown={() => {
|
caption={caption}
|
||||||
setIsDragging(true);
|
aspectRatio={aspectRatio}
|
||||||
setIsUserInteracting(true);
|
autoSlide={autoSlide}
|
||||||
}}
|
className={className}
|
||||||
onTouchStart={() => {
|
/>
|
||||||
setIsDragging(true);
|
|
||||||
setIsUserInteracting(true);
|
|
||||||
}}
|
|
||||||
className={`relative w-full ${aspectRatio} rounded-2xl sm:rounded-3xl overflow-hidden select-none cursor-ew-resize shadow-md border border-slate-900/[0.08] bg-slate-950 group`}
|
|
||||||
style={{ touchAction: 'pan-y' }}
|
|
||||||
>
|
|
||||||
{/* After Image (Background) */}
|
|
||||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
||||||
<img
|
|
||||||
src={afterUrl}
|
|
||||||
alt="After result"
|
|
||||||
loading="eager"
|
|
||||||
className="absolute inset-0 w-full h-full object-cover pointer-events-none will-change-transform"
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Before Image (Clipped Left side) */}
|
|
||||||
<div
|
|
||||||
className="absolute inset-0 overflow-hidden pointer-events-none will-change-transform"
|
|
||||||
style={{ clipPath: `polygon(0 0, ${sliderPosition}% 0, ${sliderPosition}% 100%, 0 100%)` }}
|
|
||||||
>
|
|
||||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
||||||
<img
|
|
||||||
src={beforeUrl}
|
|
||||||
alt="Before result"
|
|
||||||
loading="eager"
|
|
||||||
className="absolute inset-0 w-full h-full object-cover"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Split Divider Line */}
|
|
||||||
<div
|
|
||||||
className="absolute top-0 bottom-0 w-0.5 bg-white shadow-[0_0_12px_rgba(37,99,235,0.8)] z-20 pointer-events-none will-change-transform"
|
|
||||||
style={{ left: `${sliderPosition}%` }}
|
|
||||||
>
|
|
||||||
{/* Center Circular Touch/Mouse Handle */}
|
|
||||||
<div className="absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-white border-2 border-blue-600 shadow-xl flex items-center justify-center pointer-events-auto cursor-ew-resize hover:scale-110 active:scale-95 transition-transform duration-150">
|
|
||||||
<svg
|
|
||||||
className="w-3.5 h-3.5 sm:w-4 sm:h-4 text-blue-600"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d="M8 9l-3 3 3 3m8-6l3 3-3 3" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Floating Badges */}
|
|
||||||
<div className="absolute top-3 left-3 sm:top-4 sm:left-4 bg-slate-900/80 backdrop-blur-md px-3 py-1.5 rounded-xl text-[11px] font-mono font-bold text-white border border-white/10 pointer-events-none z-10 flex items-center gap-1.5 shadow-md">
|
|
||||||
<Eye className="w-3.5 h-3.5 text-slate-300" />
|
|
||||||
<span>{beforeLabel}</span>
|
|
||||||
</div>
|
|
||||||
<div className="absolute top-3 right-3 sm:top-4 sm:right-4 bg-gradient-to-r from-blue-600 to-indigo-600 backdrop-blur-md px-3 py-1.5 rounded-xl text-[11px] font-mono font-bold text-white shadow-md border border-white/20 pointer-events-none z-10 flex items-center gap-1.5">
|
|
||||||
<Sparkles className="w-3.5 h-3.5 text-white" />
|
|
||||||
<span>{afterLabel}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{caption && (
|
|
||||||
<p className="mt-2.5 text-center text-xs font-mono text-slate-500">
|
|
||||||
{caption}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,264 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import React, { useState, useRef, useCallback, useEffect } from 'react';
|
||||||
|
import { Eye, Sparkles, Scan, Activity } from 'lucide-react';
|
||||||
|
|
||||||
|
interface Cinematic3DComparisonProps {
|
||||||
|
beforeUrl: string;
|
||||||
|
afterUrl: string;
|
||||||
|
beforeLabel?: string;
|
||||||
|
afterLabel?: string;
|
||||||
|
caption?: string;
|
||||||
|
aspectRatio?: string;
|
||||||
|
autoSlide?: boolean;
|
||||||
|
maxTilt?: number;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Cinematic3DComparison({
|
||||||
|
beforeUrl,
|
||||||
|
afterUrl,
|
||||||
|
beforeLabel = 'RAW SOURCE',
|
||||||
|
afterLabel = 'AI RECONSTRUCTED',
|
||||||
|
caption,
|
||||||
|
aspectRatio = 'aspect-[4/3] sm:aspect-[16/10]',
|
||||||
|
autoSlide = true,
|
||||||
|
maxTilt = 7,
|
||||||
|
className = '',
|
||||||
|
}: Cinematic3DComparisonProps) {
|
||||||
|
const [sliderPosition, setSliderPosition] = useState(50);
|
||||||
|
const [isDragging, setIsDragging] = useState(false);
|
||||||
|
const [isUserInteracting, setIsUserInteracting] = useState(false);
|
||||||
|
const [tilt, setTilt] = useState({ rx: 0, ry: 0, glareX: 50, glareY: 50, active: false });
|
||||||
|
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const stageRef = useRef<HTMLDivElement>(null);
|
||||||
|
const animFrameRef = useRef<number | null>(null);
|
||||||
|
const resumeTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
const startTimeRef = useRef<number>(Date.now());
|
||||||
|
|
||||||
|
// Auto-slide smooth sine oscillation loop
|
||||||
|
useEffect(() => {
|
||||||
|
if (!autoSlide || isDragging || isUserInteracting) {
|
||||||
|
if (animFrameRef.current) cancelAnimationFrame(animFrameRef.current);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const animate = () => {
|
||||||
|
const elapsed = Date.now() - startTimeRef.current;
|
||||||
|
// Gentle cinematic oscillation between 28% and 72%
|
||||||
|
const newPos = 50 + 22 * Math.sin(elapsed * 0.0014);
|
||||||
|
setSliderPosition(newPos);
|
||||||
|
animFrameRef.current = requestAnimationFrame(animate);
|
||||||
|
};
|
||||||
|
|
||||||
|
animFrameRef.current = requestAnimationFrame(animate);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (animFrameRef.current) cancelAnimationFrame(animFrameRef.current);
|
||||||
|
};
|
||||||
|
}, [autoSlide, isDragging, isUserInteracting]);
|
||||||
|
|
||||||
|
// Handle position calculation
|
||||||
|
const handleMove = useCallback((clientX: number) => {
|
||||||
|
if (!containerRef.current) return;
|
||||||
|
const rect = containerRef.current.getBoundingClientRect();
|
||||||
|
const x = Math.max(0, Math.min(clientX - rect.left, rect.width));
|
||||||
|
const percent = Math.max(0, Math.min(100, (x / rect.width) * 100));
|
||||||
|
setSliderPosition(percent);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleTouchMove = useCallback((e: TouchEvent) => {
|
||||||
|
if (!isDragging) return;
|
||||||
|
handleMove(e.touches[0].clientX);
|
||||||
|
}, [isDragging, handleMove]);
|
||||||
|
|
||||||
|
const handleMouseMove = useCallback((e: MouseEvent) => {
|
||||||
|
if (!isDragging) return;
|
||||||
|
handleMove(e.clientX);
|
||||||
|
}, [isDragging, handleMove]);
|
||||||
|
|
||||||
|
const handleMouseUp = useCallback(() => {
|
||||||
|
setIsDragging(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isDragging) {
|
||||||
|
window.addEventListener('mousemove', handleMouseMove, { passive: true });
|
||||||
|
window.addEventListener('mouseup', handleMouseUp);
|
||||||
|
window.addEventListener('touchmove', handleTouchMove, { passive: true });
|
||||||
|
window.addEventListener('touchend', handleMouseUp);
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('mousemove', handleMouseMove);
|
||||||
|
window.removeEventListener('mouseup', handleMouseUp);
|
||||||
|
window.removeEventListener('touchmove', handleTouchMove);
|
||||||
|
window.removeEventListener('touchend', handleMouseUp);
|
||||||
|
};
|
||||||
|
}, [isDragging, handleMouseMove, handleMouseUp, handleTouchMove]);
|
||||||
|
|
||||||
|
// 3D Spatial Tilt Tracking
|
||||||
|
const handleStageMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||||
|
if (!containerRef.current) return;
|
||||||
|
const rect = containerRef.current.getBoundingClientRect();
|
||||||
|
const x = (e.clientX - rect.left) / rect.width;
|
||||||
|
const y = (e.clientY - rect.top) / rect.height;
|
||||||
|
|
||||||
|
const rx = -(y - 0.5) * maxTilt * 2;
|
||||||
|
const ry = (x - 0.5) * maxTilt * 2;
|
||||||
|
|
||||||
|
setTilt({
|
||||||
|
rx,
|
||||||
|
ry,
|
||||||
|
glareX: x * 100,
|
||||||
|
glareY: y * 100,
|
||||||
|
active: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseEnter = () => {
|
||||||
|
setIsUserInteracting(true);
|
||||||
|
if (resumeTimerRef.current) clearTimeout(resumeTimerRef.current);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseLeave = () => {
|
||||||
|
setTilt((prev) => ({ ...prev, rx: 0, ry: 0, active: false }));
|
||||||
|
if (resumeTimerRef.current) clearTimeout(resumeTimerRef.current);
|
||||||
|
resumeTimerRef.current = setTimeout(() => {
|
||||||
|
setIsUserInteracting(false);
|
||||||
|
startTimeRef.current = Date.now();
|
||||||
|
}, 2800);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`w-full perspective-1400 select-none ${className}`}>
|
||||||
|
{/* 3D Kinetic Tilt Stage */}
|
||||||
|
<div
|
||||||
|
ref={containerRef}
|
||||||
|
onMouseMove={handleStageMouseMove}
|
||||||
|
onMouseEnter={handleMouseEnter}
|
||||||
|
onMouseLeave={handleMouseLeave}
|
||||||
|
onMouseDown={() => {
|
||||||
|
setIsDragging(true);
|
||||||
|
setIsUserInteracting(true);
|
||||||
|
}}
|
||||||
|
onTouchStart={() => {
|
||||||
|
setIsDragging(true);
|
||||||
|
setIsUserInteracting(true);
|
||||||
|
}}
|
||||||
|
className={`relative w-full ${aspectRatio} rounded-2xl sm:rounded-3xl overflow-hidden cursor-ew-resize preserve-3d transition-transform duration-200 ease-out shadow-cinematic-3d hover:shadow-cinematic-hover border border-slate-900/[0.08] bg-slate-950`}
|
||||||
|
style={{
|
||||||
|
transform: tilt.active
|
||||||
|
? `rotateX(${tilt.rx.toFixed(2)}deg) rotateY(${tilt.ry.toFixed(2)}deg) scale3d(1.015, 1.015, 1.015)`
|
||||||
|
: 'rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)',
|
||||||
|
touchAction: 'pan-y',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* Layer 1: After Image (Full Reconstructed Neural Result) */}
|
||||||
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||||
|
<img
|
||||||
|
src={afterUrl}
|
||||||
|
alt="AI Reconstructed result"
|
||||||
|
loading="eager"
|
||||||
|
className="absolute inset-0 w-full h-full object-cover pointer-events-none will-change-transform"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Dynamic 3D Cursor Specular Light Glint */}
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 pointer-events-none transition-opacity duration-300 z-10"
|
||||||
|
style={{
|
||||||
|
opacity: tilt.active ? 0.65 : 0,
|
||||||
|
background: `radial-gradient(circle 380px at ${tilt.glareX}% ${tilt.glareY}%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.08) 50%, transparent 80%)`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Layer 2: Before Image (Clipped Left Side with Polygon Split) */}
|
||||||
|
<div
|
||||||
|
className="absolute inset-0 overflow-hidden pointer-events-none will-change-transform"
|
||||||
|
style={{ clipPath: `polygon(0 0, ${sliderPosition}% 0, ${sliderPosition}% 100%, 0 100%)` }}
|
||||||
|
>
|
||||||
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||||
|
<img
|
||||||
|
src={beforeUrl}
|
||||||
|
alt="Original input"
|
||||||
|
loading="eager"
|
||||||
|
className="absolute inset-0 w-full h-full object-cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Layer 3: Illuminated Holographic Laser Split Line (Champagne Gold + Electric Sapphire) */}
|
||||||
|
<div
|
||||||
|
className="absolute top-0 bottom-0 w-[2px] bg-gradient-to-b from-blue-400 via-white to-amber-300 holographic-laser-split z-20 pointer-events-none will-change-transform"
|
||||||
|
style={{ left: `${sliderPosition}%` }}
|
||||||
|
>
|
||||||
|
{/* Subtle Vertical Caustic Glow Beam */}
|
||||||
|
<div className="absolute -top-4 -bottom-4 -left-1.5 w-3.5 bg-gradient-to-r from-blue-500/20 via-white/40 to-amber-400/20 blur-[3px]" />
|
||||||
|
|
||||||
|
{/* 3D Tactile Center Control Handle floating at translateZ */}
|
||||||
|
<div
|
||||||
|
className="absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-9 h-9 sm:w-11 sm:h-11 rounded-full bg-white/95 backdrop-blur-md border border-slate-900/10 shadow-2xl flex items-center justify-center pointer-events-auto cursor-ew-resize hover:scale-110 active:scale-95 transition-transform duration-150 preserve-3d"
|
||||||
|
style={{ transform: 'translateZ(28px)' }}
|
||||||
|
>
|
||||||
|
{/* Outer Metallic Ring */}
|
||||||
|
<div className="absolute inset-0 rounded-full border border-blue-600/30 shadow-[0_0_12px_rgba(37,99,235,0.3)]" />
|
||||||
|
|
||||||
|
{/* Inner Arrows SVG */}
|
||||||
|
<svg
|
||||||
|
className="w-4 h-4 text-blue-700"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d="M8 9l-3 3 3 3m8-6l3 3-3 3" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Layer 4: Floating 3D Telemetry Badges (Floating at translateZ(32px)) */}
|
||||||
|
<div
|
||||||
|
className="absolute top-3.5 left-3.5 sm:top-5 sm:left-5 bg-white/85 backdrop-blur-md px-3 py-1.5 rounded-xl text-[10px] sm:text-[11px] font-mono font-bold text-slate-800 border border-slate-900/[0.08] pointer-events-none z-20 flex items-center gap-1.5 shadow-sm preserve-3d"
|
||||||
|
style={{ transform: 'translateZ(30px)' }}
|
||||||
|
>
|
||||||
|
<Eye className="w-3.5 h-3.5 text-slate-600" />
|
||||||
|
<span>{beforeLabel}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="absolute top-3.5 right-3.5 sm:top-5 sm:right-5 bg-gradient-to-r from-blue-600 via-indigo-600 to-blue-700 text-white backdrop-blur-md px-3.5 py-1.5 rounded-xl text-[10px] sm:text-[11px] font-mono font-bold shadow-md border border-white/20 pointer-events-none z-20 flex items-center gap-1.5 preserve-3d"
|
||||||
|
style={{ transform: 'translateZ(30px)' }}
|
||||||
|
>
|
||||||
|
<Sparkles className="w-3.5 h-3.5 text-white" />
|
||||||
|
<span>{afterLabel}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Lower Spatial Telemetry Chips (Enigma Archive Aesthetic) */}
|
||||||
|
<div
|
||||||
|
className="absolute bottom-3.5 left-3.5 sm:bottom-4 sm:left-4 hidden sm:flex items-center gap-2 pointer-events-none z-20 preserve-3d"
|
||||||
|
style={{ transform: 'translateZ(26px)' }}
|
||||||
|
>
|
||||||
|
<div className="bg-slate-950/60 backdrop-blur-md px-2.5 py-1 rounded-lg text-[9px] font-mono font-semibold text-white/90 border border-white/10 flex items-center gap-1.5">
|
||||||
|
<Activity className="w-3 h-3 text-emerald-400 animate-pulse" />
|
||||||
|
<span>DELTA DEPTH MAP</span>
|
||||||
|
</div>
|
||||||
|
<div className="bg-slate-950/60 backdrop-blur-md px-2.5 py-1 rounded-lg text-[9px] font-mono font-semibold text-white/90 border border-white/10 flex items-center gap-1.5">
|
||||||
|
<Scan className="w-3 h-3 text-cyan-400" />
|
||||||
|
<span>LOSSLESS 4K</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="absolute bottom-3.5 right-3.5 sm:bottom-4 sm:right-4 bg-white/80 backdrop-blur-md px-2.5 py-1 rounded-lg text-[9px] font-mono font-bold text-slate-700 border border-slate-900/[0.06] pointer-events-none z-20 preserve-3d"
|
||||||
|
style={{ transform: 'translateZ(26px)' }}
|
||||||
|
>
|
||||||
|
SCAN: {Math.round(sliderPosition)}%
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{caption && (
|
||||||
|
<p className="mt-3 text-center text-xs font-mono text-slate-500 tracking-wide uppercase">
|
||||||
|
{caption}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user