Closed ischurov closed 1 year ago
It seems what you are looking for is the reverse for one animation and not the whole timeline which you can simply do with rect.animate().move(...).reverse()
. However you can also reverse the whole timeline but that basically means playing it backwards. So if you are at position t=0 and playing it backwards it stops immediately because its finished. You would need to seek to a different time first in order to play it backwards. I added a button to the example to show what I mean.
Hi, @Fuzzyma , thanks for quick reply! That's actually what I was thinking about (particularly, I understood that if I invoke timeline().reverse()
during the animation, it stops and reverses animation until t=0 is reached), but the docs said otherwise (at least, in my reading), so I start thinking it's a possible bug. Thanks for the hint that I can reverse one particular animation!
Probably, we can change the documentation in some way to make it obvious for the newcomers like myself?
Currently, it reads
// will run from 100,100 to rects initial position
rect.animate(3000).move(100, 100)
rect.timeline().reverse()
It seems to me that these particular two lines should do what is said in the comment, i.e. start animation that will run from 100, 100 to rects initial position.
Probably, we can include more thorough example like you provided in the fiddle?
Thanks again!
Yeah this example is really misleading and needs be improved.
Hello @Fuzzyma, I'm finding it very hard to understand then how to reverse a completed animation (timeline)?
Here is an example that explains how to do it: https://jsfiddle.net/7rtweb9c/
Bug report
I'm trying to reproduce the documentation on
timeline().reverse()
and it doesn't work as described there (or I don't understand what is written in the docs).Fiddle
Fiddle
Explanation
What is the behaviour you expect? I expected that the rect will move from 100, 100 to the initial position (0, 0), as per the docs ("will run from 100,100 to rects initial position")
What is happening instead? Nothing changes, the rect is drawn in the initial position.
What error message are you getting? No error messages.
Thanks a lot!