Jump to content
Search Community

AwSick

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by AwSick

  1. 10 minutes ago, OSUblake said:

    Do not create a timeline or tween at the top level of function.

     

    // BAD
    const Envelope = () => {
      const t1 = gsap.timeline({ paused: true, reversed: true });
    }
    
    // GOOD
    const Envelope = () => {
      const tl = useRef();
      
      useEffect(() => {
        t1.current = gsap.timeline({ paused: true, reversed: true });
      }, []);  
    }

     

    Go back and look at the demos, like the one in the Creating and controlling timeline section.

     

     

     

     

    Thanks a lot !! , now i understand, its works.

    • Like 1
  2. 25 minutes ago, OSUblake said:

    Hi AwSlick,

     

    You should never create a timeline at the top level of a function. Once you change the state, your component will re-render, and it's going to create a brand new timeline, so you will be referencing a completely different timeline.

     

    This is explained in our React Guides.

     

     

     hi, i checked ur link, but still not understand how to fix my problem, can u please show solution on example if possible

  3. On 10/30/2021 at 5:02 PM, ZachSaucier said:

    Hey AwSick and welcome to the GreenSock forums.

     

    Which delay are you trying to reduce? I'm guessing the big change in scale at the end of your timeline? 

     

    You're using a set numerical value as the position parameter, which put the tween at the given second in time of the timeline. It's useful in some circumstances but usually other methods of positioning using the position parameter are more help, especially ones that let you position tweens relative to other tweens in the timeline. I strongly recommend going through the position parameter post. I also suggest going through the most common GSAP mistakes as you're making a couple of them.

    Thanks a lot!

×
×
  • Create New...