Jump to content
Search Community

Animation play and reverse issue

ZajeliMiGuzik test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Hello GreenSock forum!

 

I have some trouble with setting up my icon animation. If I append variables in local function, my animation start on click but not reverse on another.
Animation works if I have absolute values (without variables) but I want to have shorter code like currently. When my variables goes into global variables (like in CodePen example) my animation works but have some issues with frames and start glitching / lagging. 

I would be grateful for some help and examples to try it out.

See the Pen NWRbYGb by Baracode (@Baracode) on CodePen

Link to comment
Share on other sites

  • ZajeliMiGuzik changed the title to Animation play and reverse issue
  • Solution

 

Hey @ZajeliMiGuzik

 

If you take all those variables and the setup of the timeline out of that function, just set everything up beforehand, and on click only toglle the (play-)state of your timeline, it seems to work fine. 

 

Do you really need to have the variables inside that function? ...like, is there dynamic content, that changes with every click, or something and you need to adress that in your timeline somehow? If so, could you please make a minimal demo, of what that exactly looks like?

 

If not, I hope this already helped :) 

 

See the Pen d0905d472b06bfc639e79bcd6fe57893 by akapowl (@akapowl) on CodePen

 

 

 

Cheers,

Paul

 

 

 

  • Like 3
Link to comment
Share on other sites

21 minutes ago, akapowl said:

 

Hey @ZajeliMiGuzik

 

If you take all those variables and the setup of the timeline out of that function, just set everything up beforehand, and on click only toglle the (play-)state of your timeline, it seems to work fine. 

 

Do you really need to have the variables inside that function? ...like, is there dynamic content, that changes with every click, or something and you need to adress that in your timeline somehow? If so, could you please make a minimal demo, of what that exactly looks like?

 

If not, I hope this already helped :) 

 

 

 

 

 

 

Cheers,

Paul


Hello Paul!
Now it works perfectly, thanks very much. 

 

Quote

Do you really need to have the variables inside that function? ...like, is there dynamic content, that changes with every click, or something and you need to adress that in your timeline somehow? If so, could you please make a minimal demo, of what that exactly looks like?

I just want to use the same variable names for future timelines. Thats why I'm trying to find a solution like close variables in functions.

 

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