API Reference
@hua-labs/motion-core
v1.0.0-alpha
25개 이상의 애니메이션 훅. 의존성 없이 순수 CSS/JS로 구현.
Installation
pnpm add @hua-labs/motion-coreAvailable Hooks
25개의 애니메이션 훅
useFadeInFade in animationuseFadeOutFade out animationuseSlideUpSlide up from bottomuseSlideDownSlide down from topuseSlideLeftSlide in from rightuseSlideRightSlide in from leftuseScaleScale animationuseRotateRotation animationuseBlurBlur transitionuseBounceBounce effectuseFloatFloating animationuseShakeShake effectusePulsePulse animationuseFlip3D flipuseTypewriterTypewriter text effectuseCounterNumber counting animationuseParallaxParallax scroll effectuseStaggerStaggered list animationuseMorphShape morphinguseGlowGlow effectuseWaveWave animationuseSpringSpring physicsuseGestureGesture-based animationuseScrollScroll-linked animationuseInViewIntersection observer wrapperBasic Usage
import { useFadeIn, useSlideUp } from '@hua-labs/motion-core';
function MyComponent() {
const fadeIn = useFadeIn({ duration: 800, delay: 0 });
return (
<div ref={fadeIn.ref} style={fadeIn.style}>
Content fades in on mount
</div>
);
}Hook Return Value
interface MotionResult {
ref: React.RefObject<HTMLElement>; // Attach to element
style: React.CSSProperties; // Apply to element
isVisible: boolean; // Currently visible
isAnimating: boolean; // Animation in progress
progress: number; // 0-1 progress
start: () => void; // Start animation
stop: () => void; // Stop animation
reset: () => void; // Reset to initial
pause: () => void; // Pause animation
resume: () => void; // Resume animation
}Features
- Zero dependencies - 순수 CSS transform + opacity
- GPU accelerated - 60fps 부드러운 애니메이션
- SSR compatible - 서버 렌더링 안전
- Respects prefers-reduced-motion - 접근성 고려
- TypeScript - 완전한 타입 지원
각 훅별 상세 옵션은 별도 문서 사이트에서 제공 예정.