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

Play animation only once? #86

Open tncball33 opened 7 years ago

tncball33 commented 7 years ago

Is there a way to make the animation play only once? Currently everything defaults to repeating.

skagedal commented 7 years ago

Not sure which platform you are using, but on iOS you can set repeatCount to 1 on the KFVectorLayer. This is a property inherited from CALayer, see here. You do however have to set this on the layer before setting the face model (it would be nice if this could be modified afterwards).

m1ga commented 7 years ago

And on Android you can use kfDrawable.stopAnimationAtLoopEnd(); after you started the animation. But a general playOnce() method that handles both platforms would be nice to have

tncball33 commented 7 years ago

Thanks guys, yeah I was trying to set the repeatCount to 1. Didn't realize you had to set it before setting the faceModel. Problem looks to be solved. I also agree there should probably be some sort of general playOnce() method exposed on both platforms.

m1ga commented 7 years ago

Android PR: https://github.com/facebookincubator/Keyframes/pull/94 iOS PR: https://github.com/facebookincubator/Keyframes/pull/95