Jump to content
Search Community

Uncaught Cannot add undefined

timdt test
Moderator Tag

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

Uncaught Cannot add undefined into the timeline; it is not a tween, timeline, function, or string.

 

Hey guys, sooo  first time i am getting this. Cannot understand why.

My other documents work but with this i am suddenly getting this weird error.

Must be something i am overlooking.

 

Btw everything is in one file because i am making something for google adwords :)

 

Help would be very much appreciated.

 

Side question: 

 

item 1 from x-250 to 0 (center) fade out(opacity 0 )

item 2 from x-250 to 0 (center) fade out(opacity 0 )

item 3 from x-250 to 0 (center) fade out(opacity 0 )

 

Could this be achieved with stagger? and how?

thankss! 

 

 

See the Pen jGJBgV by timdt (@timdt) on CodePen

Link to comment
Share on other sites

Hello @timdtand welcome to the GreenSock forum!

 

This is happening due to not returning your timeline in your timelineone function. GSAP add() method expects a timeline being returned when you have a function.

 

So your missing this inside timelineone() fucntion

 

return tl;

 

And all together

 

function timelineone(){
	var tl = new TimelineMax();
	tl.from(".tekst1",1,{x:250})
  	  .to(".tekst1",1,{scale:0.1,autoAlpha:0});
  
 	return tl; // your missing this line
}

 

And now you can see your animation run
 

See the Pen gGExYd by jonathan (@jonathan) on CodePen

 

Checkout this CSS Tricks Article by the Mighty @Carl on how to write smarter animation code:

 

https://css-tricks.com/writing-smarter-animation-code/

 

 

And this:

 

 

Happy Tweening! :)

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