Jump to content
Search Community

Update tween starting values

failure13 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

Sorry for no context, it's just really hard now to make something.

 

Well i try to form my question as simple and straight as i can.

 

Let's say i have created tween like that:

target.t = TweenMax.to(target, 0.4, {
    overflow: 'hidden',
    height: initRow,
    marginTop: 0,
    marginBottom: 0,
    ease: Power1.easeInOut,
    paused: true,
    reversed: true,
    onStart: closed,
    onReverseComplete: opened
});

So at first let's say it was div with height: 2000px, then it gets collapsed by this tween, but what i need now is.

To re-check this starting value (by some event that i have), and update it if it's changed (without restarting / visually affecting tween).

Or just update it by demands, in other words!

 

Hope it ain't too clumsy.

 

Any thoughts or some native functions that i don't know about?

Link to comment
Share on other sites

Hello failure13,

 

What you could try is a number of things. You could:

If you still need assistance, then please look at creating a codepen demo example so we can better help you, Thanks!

 

I hope this helps :)

  • Like 2
Link to comment
Share on other sites

Invalidate sadly ain't works in my case, coz if i do restart it cause visual changes, my goal is to update those starting values but vithout any visual side-effects or jumps (it should always stay collapsed, before i really want to open it)

 

 

use one of the available kill methods in GSAP to kill your tween and then re-build it.

 

Can you please show some very simple example how can i do it without visually affecting tween?

I always thought that set of kill methods used for just basically null existing TweenMax object completely

 

 

  • using TimelineMax and TimelineLite you can declare a new constructor each time, if it is just a simple tween animation

 

Hmmm...Not really understood what you mean here!

Again, some simple example?

 

P.S. Sorry i just can't build any reduced pen of my context....But to emulate my event at which i need to update those values, you can juse use timer with 1000 for example

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