Will be added to npm soon
All already implemented features work the same as in gsap. Just read their documentation
-
trigger: HTMLElement
-
scrub: boolean
-
from: Object
-
to: Object
-
enable: boolean // Reactive state, True by default
const triggerRef = useRef<HTMLElement | null>(null)
const [pageLoaded, setPageLoaded] = useState(false)
const [values, states] = useSpringTrigger({
trigger: triggerRef,
start: 'top bottom',
end: 'bottom top',
scrub: true,
from: {
x: '100%'
},
to: {
x: '0%'
},
enable: pageLoaded,
onChange: (state) => {
console.log(state)
}
})
<div ref={triggerRef}>
<animated.div style={values}>
{children}
</animated.div>
</div>
- toggleActions: string