diff --git a/app/(main)/_landing/stats-bento.tsx b/app/(main)/_landing/stats-bento.tsx index ae1980f0..b329efe3 100644 --- a/app/(main)/_landing/stats-bento.tsx +++ b/app/(main)/_landing/stats-bento.tsx @@ -1,7 +1,7 @@ "use client"; import Link from "next/link"; -import { useEffect, useState } from "react"; +import { type CSSProperties, useEffect, useState } from "react"; import AnimatedBorderTrail from "@/animata/container/animated-border-trail"; import Marquee from "@/animata/container/marquee"; @@ -87,42 +87,32 @@ function OrbitItem({ duration: number; children: React.ReactNode; }) { - const startAngle = Math.round((index / total) * 360); - const [angle, setAngle] = useState(startAngle); - const [mounted, setMounted] = useState(false); + const delay = (duration / total) * index * -1; - useEffect(() => { - setMounted(true); - const id = setInterval(() => setAngle((a) => (a + 1) % 360), duration); - return () => clearInterval(id); - }, [duration]); - - const rad = (angle * Math.PI) / 180; - const x = 35 * Math.cos(rad); - const y = 15 * Math.sin(rad); - const tilt = (-30 * Math.PI) / 180; - const xT = x * Math.cos(tilt) - y * Math.sin(tilt); - const yT = x * Math.sin(tilt) + y * Math.cos(tilt); - const depth = (Math.sin(rad) + 1) / 2; - - // Round to 2 decimals to prevent hydration mismatch - const left = Math.round((50 + xT) * 100) / 100; - const top = Math.round((50 + yT) * 100) / 100; - const scale = Math.round((0.7 + depth * 0.5) * 100) / 100; - const op = Math.round((0.35 + depth * 0.65) * 100) / 100; + const orbitContainerStyle: CSSProperties = { + top: "50%", + left: "50%", + animation: ` + orbit-move ${duration}s linear infinite, + orbit-indexes ${duration}s linear infinite + `, + animationDelay: `${delay}s, ${delay}s`, + transformStyle: "preserve-3d", + }; + const itemCorrectionStyle: CSSProperties = { + animation: `counter-rotate ${duration}s linear infinite`, + animationDelay: `${delay}s`, + backfaceVisibility: "hidden", + }; return ( -