Jump to content

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

Uncaught TypeError: t[0] is undefined

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:













Here's the error itself:








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"



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

Ah.. thanks a lot, I've been reading old documents without realizing they were old, but yea I did all of that, and eventually it fixed the problem.. Thanks a million 😁.

  • Like 1
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.