Jump to content
Search Community

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

danboyle8637
Posted

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.

Posted

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
danboyle8637
Posted

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()
}, []}

 

Posted

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
Posted

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
danboyle8637
Posted

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

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.
×
×
  • Create New...