Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
danboyle8637

TweenMax error after animations run

Recommended Posts

I setup a TimelineMax sequence using SplitText... awesome by the way. Loving the SplitText. 

 

But after my animations run, I am getting this error in my console.

 

gsap-error.jpg.54c0a59ea366111142c30817a5a78660.jpg

 

Any ideas?

 

Oh... I'm building in React using Gatsbyjs... just in case.

Link to post
Share on other sites

I assume this is a stagger and you have something happening after they all complete?

 

Do you happen to have a demo? Or at the very least, what does the animation code look like?

  • Like 1
Link to post
Share on other sites

I do run a function to revert the SplitText after the animation is complete. Here's my code... 

 

useEffect(() => {
    const splitMobile = new SplitText(wordRef.current, { type: "chars" })
    const tl = new TimelineMax({ delay: 0.4 })
    const revertSplitMobile = () => splitMobile.revert()

    tl.add(
      TweenMax.staggerFrom(
        splitMobile.chars,
        0.4,
        {
          opacity: 0,
          scale: 0.6,
          y: 20,
          ease: Power2.easeOut,
        },
        0.05
      )
    )
    tl.add(
      TweenMax.staggerTo(
        splitMobile.chars,
        0.2,
        {
          color: "#6471BF",
          scale: 1.08,
          ease: Power2.easeIn,
        },
        0.05
      ),
      "-=0.5"
    )
    tl.add(
      TweenMax.staggerTo(
        splitMobile.chars,
        0.2,
        {
          color: "#383838",
          scale: 1,
          ease: Power2.easeOut,
        },
        0.05,
        "-=0.1"
      )
    )
    tl.add(revertSplitMobile)

    tl.play()
}, []}

 

Link to post
Share on other sites

The one circled is not like the others. 

TweenMax.stagger To() does not use a position parameter. 

 

Id suggest using the timeline stagger methods instead of using add() with a TweenMax.staggerTo(). Much easier to to read and type. 

 

 

 

 

DD3DEB07-17D1-423D-A373-53BBEC08CFFE.jpeg

  • Like 4
Link to post
Share on other sites

Carl beat me to it, but yeah, the position parameter is out of position in your code. It's sitting in the onCompleteAll spot.  This will work for you.

 

    tl.add(
      TweenMax.staggerTo(
        chars,
        0.2,
        {
          color: "#383838",
          scale: 1,
          ease: Power2.easeOut,
        },
        0.05
      ),
        "-=0.1"
    )

 

But I'd definitely echo @Carl's advice about not using the add() method. Happy tweening.

  • Like 2
Link to post
Share on other sites

Thanks guys! That did get rid of the error. I will do my next one with just the tl.staggerTo()... Thanks!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×