Jump to content
Search Community

Uncaught TypeError: t[0] is undefined

BrooklynTboi test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi, I've been having an issue with this error ("Uncaught TypeError: t[0] is undefined"), whenever I try to use motionPath and give it a value of an object with multiple values in it, it gives me that error, and I've been trying to solve it for so long with no use. I tried gsap.registerPlugin, I tried importing instead of CDN, I tried different syntax, all with no use. Please help, I've been at this for so long. Should also mention that the error keeps getting spammed, goes up to 90 times sometimes, but it's repeats anyways. Here's the code:

 

Javascript:

image.png.cb508e18c3ef079070e9abb03e454734.png

 

CSS:

 

image.thumb.png.68291295b9b8ae09bbd165ecbcb0c628.png

 

HTML:

 

image.thumb.png.418a2a11e735caf801a44f5b1374d1da.png

 

Here's the error itself:

 

image.thumb.png.2b13f4c34e560555a8a5fb4f4b973ab6.png

image.thumb.png.f695379f0cc34f62235127e14267f626.png

image.thumb.png.7ad1dd70dba3ccdbd7ed5d8c3125e56b.png

image.thumb.png.0913804724d30bd94bc0c7afe1f7d3e3.pngimage.thumb.png.36d2261780cb9ec0893ce1a45fed2194.png

 

image.png

Link to comment
Share on other sites

  • Solution

Welcome to the forums, @BrooklynTboi. A few things...

  1. You definitely shouldn't be using ScrollMagic. That's very old and is not a GreenSock product and doesn't work with the modern GSAP 3. I'd strongly recommend switching to ScrollTrigger which is far more capable. 
  2. This doesn't make much sense and is problematic: 
    tl.add( tl.to(...) )

    That's literally trying to add a timeline as a child to ITSELF :) I'm not sure what you were trying to do there, but you could probably just delete the tl.add(...) wrapper. 

  3. The values of your motionPath should be an Array with multiple values. It doesn't make much sense to plot a curved path through one point :)
  4. I'd strongly recommend using the modern GSAP 3 syntax, like string-based eases. 
    // OLD
    ease: Power1.easeInOut
    
    // NEW
    ease: "power1.inOut"

    See

 

If you still need some help, please provide a minimal demo (like in CodePen or CodeSandbox) and we'd be happy to answer any GSAP-specific questions. 

 

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