Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(ui): improve MulticaIcon animation behavior

Naiyuan Qingb825c6b3d8aa
diff --git a/packages/ui/src/components/multica-icon.tsx b/packages/ui/src/components/multica-icon.tsx
index c5d87e3080..7c37617529 100644
--- a/packages/ui/src/components/multica-icon.tsx
+++ b/packages/ui/src/components/multica-icon.tsx
@@ -1,8 +1,9 @@
+import { useState, useEffect } from "react";
import { cn } from "@multica/ui/lib/utils";
interface MulticaIconProps extends React.ComponentProps<"span"> {
/**
- * If true, play a one-time entrance spin animation (2 seconds).
+ * If true, play a one-time entrance spin animation.
*/
animate?: boolean;
}
@@ -17,11 +18,20 @@ export function MulticaIcon({
animate = false,
...props
}: MulticaIconProps) {
+ const [entranceDone, setEntranceDone] = useState(!animate);
+
+ useEffect(() => {
+ if (!animate) return;
+ const timer = setTimeout(() => setEntranceDone(true), 600);
+ return () => clearTimeout(timer);
+ }, [animate]);
+
return (
<span
className={cn(
- "inline-block size-[1em] hover:animate-spin",
- animate && "animate-welcome-spin",
+ "inline-block size-[1em]",
+ !entranceDone && "animate-entrance-spin",
+ entranceDone && "hover:animate-spin",
className
)}
aria-hidden="true"
diff --git a/packages/ui/src/styles/globals.css b/packages/ui/src/styles/globals.css
index 98081a6045..87ca6fc2e5 100644
--- a/packages/ui/src/styles/globals.css
+++ b/packages/ui/src/styles/globals.css
@@ -297,13 +297,13 @@
50% { box-shadow: 0 0 0 3px oklch(0.6 0.2 250 / 0); }
}
-/* Welcome page: one-time spin animation for icon */
-@keyframes welcome-spin {
+/* Multica icon: entrance spin */
+@keyframes entrance-spin {
0% { transform: rotate(0deg); opacity: 0; }
- 30% { opacity: 1; }
+ 50% { opacity: 1; }
100% { transform: rotate(360deg); opacity: 1; }
}
-.animate-welcome-spin {
- animation: welcome-spin 2s ease-out forwards;
+.animate-entrance-spin {
+ animation: entrance-spin 0.6s ease-out forwards;
}