Jump to content
Search Community

Fetch values midway through timeline / real-time evaluating?

Acccent 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 everyone :)

 

So, I think this is something that must have been asked before, but I can't for the life of me find any references.

Is there a way to have a tween inside a timeline get values based on the current state of elements that are being animated? You'll see what I mean in the codepen. (which has a nice url, by the way.)

 

I assume it isn't possible because GSAP caches everything before the animation starts, so the values would be calculated based on how things look before any change. But I thought I'd ask, in case I'm wrong.

 

I guess a solution to this would be to place a .call() inside a timeline, something like

.call(() => { TweenLite.to(element, 1, { x: <get values here> });  })

 

...but perhaps there's something easier/neater that I'm not thinking of?

 

Cheers :)

See the Pen ppXXMP by Acccent (@Acccent) on CodePen

Link to comment
Share on other sites

Ah, lovely! I don't know if the ModifiersPlugin will do it, but the function-based values surely will. That's a bit new, isn't it? ...I guess more than a year old, based on that post's date... well, I'm glad I learnt about it now, better late than never haha. Thanks!!

 

edit: yep, they totally did. perfect :)

  • Like 2
Link to comment
Share on other sites

I feel like this is such a major shift in what GSAP is able to do; it's not really an 'animation' platform anymore, it's more like a 'universal real-time animation and element manipulation platform'.

 

The one problem I have is that I feel the docs could benefit from a revamping now. I've come back to the forums to find the answer to my question above, and I did, but in the process I found out about a bunch of other things that could have made my life easier before, and that are only documented in forum posts or release announcements. (For example, the function-based values are not mentioned in the docs for TweenLite.to, when it feels like an incredibly important thing to know about.)

 

This is not really a criticism or anything, I just feel like right now the thing that GSAP would benefit the most from is not new features or revisions, but rather an improved exposition of its capabilities (again, at this point it's so much more than an animation tool – I could probably make the case for its use as a full-blown HTML game engine) and a reorganisation of the docs to give an immediate idea of all the possibilities (the main page for TweenLite, TimelineLite and their Max counterparts are very long descriptions of their most basic use – and that could be relegated to the corresponding TweenLite.to page).

 

Just my two cents! :)

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