Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TweenMax delay is not honored when restart is called #32

Open
RobTiu opened this issue Jan 16, 2017 · 2 comments
Open

TweenMax delay is not honored when restart is called #32

RobTiu opened this issue Jan 16, 2017 · 2 comments

Comments

@RobTiu
Copy link

RobTiu commented Jan 16, 2017

Hi, I noticed that when I call restart on a TweenMax controller, the .restart( includeDelay:Boolean, suppressEvents:Boolean ) : * is not honored. This is my tweenmax function:

function animateTextDesign({ target }) {
  return TweenMax.from(target.find({ id: 'textdesign' }), 6, { autoAlpha: 0, delay: 1.9 }); 
}

but when I call this.animateDesign.restart(true, false); the animation does restart but the delay is non-existent. Please let me know if you are experiencing the same issue or if I'm doing anything wrong. Or you could show me another way to restart the animation with the delay.

edit: There is another way I was able to restart the animation but it's pretty dirty. I would prefer if I could use the restart:

this.animateDesign.kill();
this.animateDesign = this.addAnimation(animateDesign);
@azazdeaz
Copy link
Owner

Hi, the restart call on the controller should have been proxied to the GSAP Animation instance with all the arguments. https://github.com/azazdeaz/react-gsap-enhancer/blob/master/src/Controller.js#L129
If you can't find the problem please create a demo with your issue on codepen.

@RobTiu
Copy link
Author

RobTiu commented Jan 16, 2017

Ok so I've narrowed down where my code is failing. Here is a codepen to illustrate where the restart with delay fails. https://codepen.io/robtiu/pen/YNpKVp?editors=0010#0

I modified your original code pen to include a container component. When the button in the container is clicked, a state variable is changed which the login component detects in componentWillReceiveProps(nextProps) and executes the restart. The delay will be nonexistent here.

If you click on the + on the login component on the other hand, the animation successfully restarted with the delay.

My question is this, how do I get the parent component to restart the animation of its child components? I'm not sure if I'm approaching this problem the right way by using componentWillReceiveProps. I've used refs before but I've been told it's not a good idea to use refs and that I should go with states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants