"use client"; import React, { useRef } from "react"; import { Canvas, useFrame } from "@react-three/fiber"; import { EffectComposer, Bloom, Vignette } from "@react-three/postprocessing"; import { KernelSize } from "postprocessing"; import { COLORS } from "./constants"; import { damp, lerp } from "./math"; import HologramCity from "./HologramCity"; import RouteSystem from "./RouteSystem"; import VehicleFleet from "./VehicleFleet"; import AICore from "./AICore"; type Props = { progress: React.RefObject; reduced?: boolean; isMobile?: boolean; /** Pause the render loop when the section is scrolled off-screen. */ active?: boolean; }; /** Slow cinematic camera move from a high chaotic view to a settled framing. */ function CameraRig({ progress }: { progress: React.RefObject }) { const eased = useRef(0); useFrame((state, dt) => { const p = progress.current ?? 0; eased.current = damp(eased.current, p, 1.5, dt); const e = eased.current; const t = state.clock.elapsedTime; const radius = lerp(17, 13, e); const angle = lerp(-0.5, 0.45, e) + t * 0.02; const height = lerp(9, 6.5, e) + Math.sin(t * 0.4) * 0.3; const cam = state.camera; cam.position.x = Math.sin(angle) * radius; cam.position.z = Math.cos(angle) * radius; cam.position.y = height; cam.lookAt(0, 2.4, 0); }); return null; } function OptimizationCanvas({ progress, reduced = false, isMobile = false, active = true }: Props) { const cityCount = isMobile ? 48 : 90; return ( {/* Bloom is what turns the additive-blended wireframes/beams into a real glowing hologram. Skipped under reduced-motion; lighter on mobile. */} {!reduced && ( )} ); } export default React.memo(OptimizationCanvas);