Skip to content

textura-agency/react-spring-trigger

Repository files navigation

🏯 React Spring Trigger - like gsap trigger but for the react-spring

How to use

Will be added to npm soon

Important!

All already implemented features work the same as in gsap. Just read their documentation

🗻 Available Parameteres

  • trigger: HTMLElement

  • scrub: boolean

  • from: Object

  • to: Object

  • enable: boolean // Reactive state, True by default

Example

    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>

In Development

  • toggleActions: string

About

🤝Works like GSAP trigger, but for the react-spring

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published