useSlideDown
@hua-labs/hua/motion
bash
npm install @hua-labs/huatsx
import { useSlideDown } from "@hua-labs/hua/framework";tsx
const slideDown = useSlideDown({ duration: 700, delay: 100 });
return (
<div ref={slideDown.ref} style={slideDown.style}>
Slides in from top to bottom
</div>
);| duration | number | 700 | Animation duration in milliseconds |
| delay | number | 0 | Delay before animation starts |
| distance | number | 50 | Slide distance in pixels |
| threshold | number | 0.1 | Viewport intersection threshold (0-1) |
| triggerOnce | boolean | true | Only trigger once |
| easing | string | "ease-out" | Easing function |
| autoStart | boolean | true | Auto start on viewport entry |
| onComplete | () => void | - | Callback when animation completes |
| onStart | () => void | - | Callback when animation starts |
| onStop | () => void | - | Callback when animation is stopped |
| onReset | () => void | - | Callback when animation is reset |
| ref | RefObject<T | null> | Ref to attach to element |
| style | CSSProperties | Animated style (translateY + opacity) |
| isVisible | boolean | Whether element is in viewport |
| isAnimating | boolean | Whether animation is in progress |
| progress | number | Animation progress (0-1) |
| start | () => void | Start animation |
| stop | () => void | Stop animation |
| reset | () => void | Reset to initial state |