diff --git a/components/sections/CloudRevealSection.tsx b/components/sections/CloudRevealSection.tsx index c290eb2..7460c7c 100644 --- a/components/sections/CloudRevealSection.tsx +++ b/components/sections/CloudRevealSection.tsx @@ -11,7 +11,7 @@ import { } from 'framer-motion' import UnitRevealOverlay from './UnitRevealOverlay' -const TOTAL_FRAMES = 299 +const TOTAL_FRAMES = 298 const FRAME_PATH = (n: number) => `/frames/ezgif-frame-${String(n).padStart(3, '0')}.jpg` @@ -51,6 +51,10 @@ export default function CloudRevealSection() { const progressScaleX = useTransform(scrollYProgress, [0, 1], [0, 1]) // --- Text phase opacities --- + // Logo: 0–8% görünür, sonra kaybolur + const logoOpacity = useTransform(scrollYProgress, [0, 0.02, 0.08, 0.14], [0, 1, 1, 0]) + const logoScale = useTransform(scrollYProgress, [0, 0.02], [0.92, 1]) + // Phase 1: 0–15% → tagline (sol alt) const phase1Opacity = useTransform(scrollYProgress, [0, 0.05, 0.12, 0.18], [0, 1, 1, 0]) const phase1Y = useTransform(scrollYProgress, [0, 0.05], [20, 0]) @@ -174,6 +178,18 @@ export default function CloudRevealSection() { )} + {/* LOGO — merkez, ilk frame'de görünür, scroll ile kaybolur */} + +

+ VESTA +

+
+

Muğla

+ + {/* PHASE 1 — Sol alt: Ana tagline */} + + + ) +} + function UnitHotspots({ scrollYProgress, onSelect, @@ -291,7 +332,6 @@ function UnitHotspots({ className="absolute" style={{ left: `${spot.x}%`, top: `${spot.y}%` }} > - {/* Dot + çizgi + kart — yatay flex */}
{/* Pulsing dot */} @@ -300,24 +340,19 @@ function UnitHotspots({ - {/* Animated çizgi */} - + {/* Zigzag çizgi */} + {/* Ok ucu */} {spot.dir === 'right' - ? - : + ? + : } @@ -325,7 +360,7 @@ function UnitHotspots({ onSelect({ id: spot.id, label: spot.label, sub: spot.sub })} > diff --git a/components/sections/UnitRevealOverlay.tsx b/components/sections/UnitRevealOverlay.tsx index c5a06e0..e603303 100644 --- a/components/sections/UnitRevealOverlay.tsx +++ b/components/sections/UnitRevealOverlay.tsx @@ -6,6 +6,11 @@ import { X } from 'lucide-react' const UNIT_FRAMES = 120 +// Video kullanan birimler +const VIDEO_UNITS: Record = { + 'blok-a': '/unit-videos/blok-a.mp4', +} + interface UnitRevealOverlayProps { unitId: string | null unitLabel: string @@ -19,6 +24,22 @@ export default function UnitRevealOverlay({ unitSub, onClose, }: UnitRevealOverlayProps) { + const isVideo = unitId ? !!VIDEO_UNITS[unitId] : false + + // ── Video mode ────────────────────────────────────────────────── + const videoRef = useRef(null) + const [videoFinished, setVideoFinished] = useState(false) + + useEffect(() => { + if (!unitId || !isVideo) return + setVideoFinished(false) + const v = videoRef.current + if (!v) return + v.currentTime = 0 + v.play().catch(() => {}) + }, [unitId, isVideo]) + + // ── Frame mode ─────────────────────────────────────────────────── const canvasRef = useRef(null) const framesRef = useRef([]) const rafRef = useRef(null) @@ -26,9 +47,8 @@ export default function UnitRevealOverlay({ const [loaded, setLoaded] = useState(false) const [finished, setFinished] = useState(false) - // Frame'leri preload et useEffect(() => { - if (!unitId) return + if (!unitId || isVideo) return setLoaded(false) setFinished(false) @@ -55,9 +75,8 @@ export default function UnitRevealOverlay({ } return () => { cancelled = true } - }, [unitId]) + }, [unitId, isVideo]) - // Canvas boyutu useEffect(() => { const canvas = canvasRef.current if (!canvas) return @@ -70,9 +89,8 @@ export default function UnitRevealOverlay({ return () => window.removeEventListener('resize', resize) }, []) - // Yüklenince otomatik oynat useEffect(() => { - if (!loaded) return + if (!loaded || isVideo) return const canvas = canvasRef.current const ctx = canvas?.getContext('2d') @@ -83,22 +101,18 @@ export default function UnitRevealOverlay({ const interval = 1000 / fps let last = 0 - const draw = (imgs: HTMLImageElement[], index: number) => { - const img = imgs[index] - if (img?.complete && img.naturalWidth > 0) { - ctx.drawImage(img, 0, 0, canvas.width, canvas.height) - } - } - const animate = (ts: number) => { if (ts - last >= interval) { - draw(framesRef.current, frame) + const img = framesRef.current[frame] + if (img?.complete && img.naturalWidth > 0) { + ctx.drawImage(img, 0, 0, canvas.width, canvas.height) + } last = ts if (frame < UNIT_FRAMES - 1) { frame++ } else { setFinished(true) - return // son frame'de dur + return } } rafRef.current = requestAnimationFrame(animate) @@ -108,9 +122,9 @@ export default function UnitRevealOverlay({ return () => { if (rafRef.current) cancelAnimationFrame(rafRef.current) } - }, [loaded]) + }, [loaded, isVideo]) - // ESC ile kapat + // ESC kapat useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose() @@ -119,6 +133,8 @@ export default function UnitRevealOverlay({ return () => window.removeEventListener('keydown', onKey) }, [onClose]) + const showInfo = isVideo ? videoFinished : finished + return ( {unitId && ( @@ -129,20 +145,34 @@ export default function UnitRevealOverlay({ transition={{ duration: 0.4 }} className="fixed inset-0 z-50 bg-black" > - {/* Canvas */} - + {/* Video modu */} + {isVideo && ( +