Jump to content
Search Community

ANIMATE back to default values (not clearProps!)

katerlouis 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

It's not a good idea to hardcode animate back to defaults. What if the color I started with changes in my CSS?

 

So I have to read out the things I want to change and store them in an object. This is no fun;

 

I tried clearProps in the .to() function, which just sets it after the tween-duration. It doesn't animate back to it.

 

I hope that my "default-storing" is already done by GSAP and wonder if somebody could tell me :)

 

Thanks! 

 

 

Louis

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,

 

Thanks for your question.

 

Yes, the engine internally stores the start and end values for tweens.

 

If you want to animate back to the starting values you would just use myTween.reverse()

 

I suspect you want more than that but I'm not understanding fully. Can you please provide a demo and more of an explanation of what you are trying to achieve.

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