Jump to content
GreenSock

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

Uncaught Cannot add undefined

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Nice work, Jonathan. Thanks!

  • Like 2

Share this post


Link to post
Share on other sites

timdt from your side question it looks like you might need 1 staggerFrom() for the x and another simultaneous staggerTo() for the opacity.  Maybe something like this:

 

See the Pen MExvXJ by GreenSock (@GreenSock) on CodePen

 

EDIT: just saw that you did have a demo 

  • Like 4

Share this post


Link to post
Share on other sites

Thanks allot i fixed it! Will watch the video's and awesome that you provided me with so much information.

You guys are great.

 

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

 

  • Like 4

Share this post


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

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. 


  • Recently Browsing   0 members

    No registered users viewing this page.

×