Jump to content
Search Community

TimelineMax: Update values at run-time?

acidking 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

I have a line in the timeline such as:

.fromTo('.divName', 1, {left: '0' }, {left: '100'})

How can I update the value of left: 0, for example, to another value, at run-time while the animation is playing? I tried to use a variable, but things started to behave in a weird way.

Link to comment
Share on other sites

Are you saying that as the object is moving from left 0 to left 100 you want to change where it came from and not where its going?


When you change where its coming from, is that tween supposed to start at the beginning?


Are there other tweens running at the same time in the timeline?


It would really help to see an example of what you are trying to do with a better explanation of the use that would trigger this and how you expect everything to respond.


From what you are describing, I would suggest rewinding parent timeline back to the start of that tween, removing the tween, and adding a new one. Not really something all that simple. Again without knowing more its tough to suggest an adequate solution.

Link to comment
Share on other sites

Yes in the middle of the tween I'd like to change a value, without rewinding or restarting, so if for example it reached the middle of the tween at 0.5 secs, it would become left:50, then I change the starting value to left:20, then instead of where the play head is at left:50, it would become left:40. Hope that makes sense.


I am basically using scroll position to play the animation, kind of parallax behaviour, so I can't restart unless I scroll back to the top and than back again to the previous location, which wouldn't look nice.

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