Jump to content
Search Community

clearProps for all TimelineMax

amihanya
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

Posted

Hello :)

I try to clearProps  for my TimelineMax and i didnt found the right way to do it.

I build the TimelineMax every play for other items and i want to clear all before i build the new one.

How can i do that?

Posted

Hm, I'm not sure I understand your goal here - it's very uncommon for someone to want to clearProps on every child tween inside of a timeline. If your goal is to simply revert the properties to where they were when the timeline started and kill it, you can do: 

 

yourTimeline.seek(0).kill(); 

 

Are you trying to literally remove all the inline styles of every target that was animated? If so, it'd probably be simplest to just use document.querySelectorAll() and loop through the results setting style.cssText = "". 

 

Does that help? If you're still struggling, it'd be very helpful if you could provide a little context and the "why" behind your request. A codepen demo would be even better :)

  • Like 3
Posted

Thanks for the answer.

I build a software that let you load the JS file that AbodeAnimate create and make all the animation with GreenSock. you drag the items and add the properties.

i want to let the user option to play the timeline every time. but after 1 or 2 time if the user click on the player the time line calculate from the currect params and not from the orginal params.

little screenshot for example:

Recording_173.gif

Posted

If your goal is to clear out the recorded starting values and force them to be re-recorded from their current states, you can simply call:

 

yourTimeline.invalidate();

 

https://greensock.com/docs/TimelineLite/invalidate()

 

No need to kill() or recreate anything (unless you're changing the end values). 

  • Like 2
Posted

Thanks Jack!
I want to record from the started states (before i set all the tweens ever) not from current states.  

Posted

Okay, then wouldn't the first solution I offered work? 

Posted

No because of the item start be in alpha=0 i don't want that he be 0 (when i dont play the timeline).

Posted

Sorry, I have no idea what you're asking. Can you please clarify your question? I really want to help, but I don't know exactly what you want or what's getting in your way. Do you have a reduced test case in codepen that demonstrates the issue? 

  • Like 2
Posted

sorry my project now is complicated for CodePen, i found a way to set all params to the original (i save it on other object and set before i build the new timeline), and that work for me! thanks for the help :)

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