How to pause a animation in nativescript-vue

84 Views Asked by At

I use AnimationSet with AnimationDefinitions in my project.

When I call AnimationSet.cancel(), the element reset to its initial state.

It seems like the cancel() method can be customized. So, is there a way to save the current element state by custom the cancel() method and making it looks like a pause action? Or, is there any other way to achieve this effect?

1

There are 1 best solutions below

0
Derek Kuo On

Resolved by:

start() {
  // "Create new Animation with AnimationDefinitions with initial state or existing recorded state"
  // "Play and record state in the background in millisecond level"
}

pause() {
  // "Clear old Animation"
  // "Create new one with recorded state with setting the duration to 1"
  // "Play"
}

Maybe it's not a proper solution. But for now, I can only find out this hack way. And it just works fine for me.