@omnific/animate
v0.2.0
Published
WAAPI-based animate utilities for Omnific packages
Maintainers
Readme
@omnific/animate
WAAPI-based mini animate utilities for Omnific packages.
useAnimate
import { useAnimate } from '@omnific/animate'
import { useEffect } from 'react'
const [scope, animate] = useAnimate<HTMLDivElement>()
useEffect(() => {
if (!scope.current) return
// resolves on complete; rejects with AbortError on stop/cancel
animate(scope.current, { opacity: 1, width: 120 }, { duration: 0.3 })
}, [animate, scope])
return <div ref={scope} />