Jump to content
GreenSock

apawsey

Members
  • Posts

    2
  • Joined

  • Last visited

apawsey's Achievements

0

Reputation

  1. Hi, Sorry if I didn't make it clear. Yes I'm suggesting an onReverseStart to mirror onStart, ie: when the playhead is at 1 and you call reverse() If we take the docs on onStart into account it would be described as: onReverseStart : Function - A function that should be called when the tween reverses from the end state (when its playhead changes from 1 to some other value which can happen more than once if the tween is reversed multiple times). It just seems like the API is incomplete, if you take these scenarios into account: Playhead at 0 - call play - onStart Playhead reaches 1 - onComplete Playhead at 1 - call reverse - no callback playhead reaches 0 - onReverseComplete I will put together a demo, it's a fair point, although I'll have to do it a little later this evening - today's not a good day for spare time Please feel free to leave any replies on that point until I've posted that demo! Thanks for the answer with the easing, but again I didn't make it clear it seems. Your demo show's exactly what I was describing; if the tween ends with a bounce, the easing is reversed (in that it performs the same easing in exactly the opposite direction) and the animation starts with a bounce when it is reversed. ie: Bounce.easeOut does effectively become Bounce.easeIn. The question comes from the fact that I am migrating from velocity. With velocity, the easing applies to the "tween" the same way regardless of play direction. If you bounce out when playing forwards, you bounce out when playing backwards. This does seem to be a useful option to have in your API. Reversing is perfect for moving elements in or out of some key area (usually the viewport) but I would my elements to glide to a stop in both directions for example. Here is your demo (poorly) migrated to velocity (okay I did manage to squeeze this one into the time I have). http://codepen.io/apawsey/pen/gbaOaL Thanks for the feedback! Cheers, Adam.
  2. Hi Guys, Let's get the niceties out of the way... GSAP is amazing, currently migrating to it from velocity. I've been looking through the forums regarding the topic of onReverseStart and there's a number of posts saying it's unnecessary because you'll be calling reverse() from some method anyway so why not just do what you need there. But I don't understand how that's any different from onStart? It seems a fairly simple use case. In my case I'm animating the transition between an introductory page and some content. This transition is reversible, ie: you can go from the intro to the content and back again. As I switch from one to the other I need to make a couple of tweaks to classes etc, and enable/disable a couple of elements. If there was an onReverseStart callback, I could keep everything clean and simple (weird psudeo code follows): onStart & on ReverseStart shared method - check which way we're going and make updates. onComplete & onReverseComplete shared method - check which way we went and make updates. toggle method - if (inIntro) timeline.play() else timeline.reverse() As there isn't an onReverseStart, the best I can get is: onStart - must be going from intro to content - make changes. onComplete & onReverseComplete shared method - check which way we went and make updates. toggle method - check which way we're going, if it is from content to intro (ie: reverse) make the changes and call reverse(), else call play(). That seems a little messy to me. Also just wanted to clarify something? If I reverse a timeline, that means any easing is reversed as well? Thanks, Adam.
×