Jump to content
Search Community

Added function stops further timeline execution

Reincha 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

Hi!

Please see my codepen example.

Why the timeline doesn't execute "to" command after function call?

(the commented out variation of adding works, but is it correct?)

I'm new to Js & GSAP so there may be issues with my code as I couldn't find similar issues on the forum.

Thanks in advance!

See the Pen RvXzjV by reincha (@reincha) on CodePen

Link to comment
Share on other sites

Hi @Reincha,

 

Yes, the commented out version is correct! If you place a call to a function directly into the add() parameter, it's called at runtime. When you pass an anonymous function as the parameter, it's called at that position in the timeline.

 

Have a look here to see that even if you .add( someFunction() ) to the very end of the timeline, it's called immediately.

 

 

See the Pen pGMMZy by sgorneau (@sgorneau) on CodePen

 

 

Hope this helps!

 

Link to comment
Share on other sites

Looking further down ... it looks like you're doing all the interpolating way outside of GSAP ... so that is all happening without a Timeline's awareness. And following to(), from(), etc is just going to be called.  (I'm on my first cup of coffee ... so I could be wrong)

 

In regard to tweening the SVG shape and position ... you should probably look at MorphSVG in combination with simple tween properties (y in this example).

 

https://greensock.com/morphSVG

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