PDA

View Full Version : Reverse animation without transition



matinzk
8th July 2016, 12:00
I have an animation which is a series of SequentialAnimation. I start it and it runs to the end. Is there a way of reversing it without using transitions or designing another series of SequentialAnimation the other way around?

I run it by setting a variable to a 0 or or 1. I would like it to run when this variable is 1 and then reverse to the beginning from where it could be when the variable is 0 for instance.

Any help is appreciated.

Thank you.

anda_skoa
8th July 2016, 13:12
No, that's not possible.

It might be possible to generate a second sequence that has the same list of sub animations but in reverse order, but it is, at least no generally, possible to reverse each child transition.

E.g. the easing curve could not be exactly reversible, or the animation might only have a "to" value, so the reverse would miss its "to" value, etc.

Cheers,
_

matinzk
8th July 2016, 17:21
Thank you for your reply. I guessed that it wouldn't be possible so I have already produced a second reverse sequence. The issue however is if I stop the first sequence in the middle of the run and start the reverse sequence, since everything will start from the beginning, it will take a while to get to that particular point to then see the reverse effect take place. Do I make sense? Is there a way of avoiding that?

anda_skoa
9th July 2016, 10:03
If you want the first sequence to jsut some to its end you could call complete(), so it would end with values that the reverse sequence expects to start with.

Cheers,
_

matinzk
9th July 2016, 17:06
I'm not worried about the values where it starts off from. What I want to do is if the sequence is in middle of run and when I want to reverse it the reverse should happen from that point. Just like a video clip if I start rewinding if from the midpoint it doesn't complete the clip before it reverses it, it just reverses it from that point.

anda_skoa
9th July 2016, 18:14
Have you tried setting the duration of those animations you want to skip to 0?

Cheers,
_

matinzk
9th July 2016, 19:15
Every part has a duration, I'm not sure I understand what you're saying :)

anda_skoa
10th July 2016, 08:59
If I understood you correctly you have a reverse sequence that you want to start somewhere in the middle. not at the beginning.
Since the sequence will always start at the first child animation, you could let all children before the wanted start have a 0 durationn.

Alternatively you could create your own sequence handling, i.e. not use a SequentialAnimation.

Cheers,
_