Jump to content
Search Community

priyanshu23

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by priyanshu23

  1. I just started learning react.js with gsap and stuck at this point

     

    useEffect(() => {
    
    	const cx = gsap.context(() => {
    		const tl = gsap.timeline({
                    scrollTrigger: {
                        trigger: '.home',
                        start: 'top top',
                        end: "+=" + window.innerHeight * 3,
                        pin: true,
                        scrub: 1
                    }
                })
                }, main_ref)
            
            return ()=>{
              cx.revert()
            }
    })

     

    my question is that, How can I declare this timeline globally because I want to use this timeline in multiple components or there is any other way to perform the same thing.

    And yeah, this timeline is declared in the App.jsx file which is the main file of my project. 

     

    Thanks in advance.

     

     

×
×
  • Create New...