useSlideRight
@hua-labs/hua/motion
bash
npm install @hua-labs/huatsx
import { useSlideRight } from "@hua-labs/hua/framework";tsx
const slideRight = useSlideRight({ duration: 700, delay: 100 });
return (
<div ref={slideRight.ref} style={slideRight.style}>
Slides in from left to right
</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 |
| ref | RefObject<T | null> | Ref to attach to element |
| style | CSSProperties | Animated style (translateX + 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 |