facebookarchive / Keyframes

A library for converting Adobe AE shape based animations to a data format and playing it back on Android and iOS devices.
https://facebookincubator.github.io/Keyframes/
Other
5.33k stars 302 forks source link

[iOS] Animate a Window of the timeline #48

Closed mohamede1945 closed 7 years ago

mohamede1945 commented 7 years ago

Suppose, my vector file contains 3 seconds of animation. How can I animate only part of it, like from second 2 to second 3? In other words, from progress 0.3333 to progress 0.6666. I think right now this is not supported by the framework, but I'd like to know some ideas so I can implement it myself.

renyu-io commented 7 years ago

Hi @mohamede1945 I don't know what's your exact use case. But I guess you can,

  1. use KFVectorFromDictionaryInRange to only export part of the whole animation or
  2. in After Effect, trim your animation to that range before exporting.

It's not very straightforward to control the animation playback programmatically, you might want to check CAMediaTiming

mohamede1945 commented 7 years ago

Thank you so much! I think I will go with the KFVectorFromDictionaryInRange. I was trying to do it with CAMediaTiming but failed.

My use case was to animate an image between 3 states, (A, B, C). User taps on the button the image animates A -> B taps again B -> C taps again C -> A. I wanted to do it with just one vector so that I don't recreate CALayers again.