useSmartMotion
@hua-labs/hua/motion
bash
npm install @hua-labs/huatsx
import { useSmartMotion } from "@hua-labs/hua/framework";tsx
const card = useSmartMotion({
type: "card",
entrance: "slideUp",
hover: true,
delay: 200,
});
return (
<div ref={card.ref} style={card.style} className="card">
Smart motion card
</div>
);| type | "hero" | "title" | "button" | "card" | "text" | "image" | - | Element type for preset behavior |
| entrance | "fadeIn" | "slideUp" | "slideLeft" | "slideRight" | "scaleIn" | "bounceIn" | - | Entrance animation type |
| hover | boolean | - | Enable hover effects |
| click | boolean | - | Enable click effects |
| delay | number | 0 | Animation delay in milliseconds |
| duration | number | 700 | Animation duration in milliseconds |
| threshold | number | 0.1 | Viewport intersection threshold (0-1) |
| autoLanguageSync | boolean | false | Re-trigger animation on language change |
| ref | RefObject<T | null> | Ref to attach to element |
| style | CSSProperties | Animated style object |
| isVisible | boolean | Whether element is in viewport |
| isHovered | boolean | Whether element is hovered |
| isClicked | boolean | Whether element is clicked |