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: Add playOnce() for Parity #95

Closed hansemannn closed 6 years ago

hansemannn commented 7 years ago

This PR adds the addOnce() functionality from #94 for iOS as well. It's a common use-case for showcase animations, so I like the idea of a cross-platform API. Also fixing minor typo issues in the iOS docs. :-)

The user should not pause and restart the animation, since my GCD timer waits for the finishing frames already, but people using this method instead of startAnimation will know that behavior.

Feedback very welcome!

lozzle commented 7 years ago

Thanks for the PR and sorry it's been sitting around! Our eng working on the iOS side are out on holiday for a bit, and I'm not as comfortable reviewing 😨

hansemannn commented 7 years ago

@lozzle All good! I feel like the PR could even be improved in terms of default values. Will check back then!

renyu-io commented 7 years ago

Hi @hansemannn I am not very confident about this approach. Is there a possibility that we will see first several frames before the callback is called?

hansemannn commented 7 years ago

@LazyChild You mean the dispatch callback? I didn't see any UI glitches during my tests. Currently, I tried to use only top-level API's so it doesn't mix-up the internal logic structure, but if you rather could think of something else, please let me know! It not a definite solution 😊

hansemannn commented 7 years ago

@LazyChild Where should we go from here? What improvements would you suggest? The public API is limited to this use-case, so I don't see many alternatives. It's working fine for all my tested examples, if that helps.

renyu-io commented 7 years ago

@hansemannn Sorry get back to you very late.

My initial thoughts would be doing something like this self.repeatCount = 1; [self startAnimation];

But this needs us to fix the issue that repeatCount couldn't change after the model is set up.

renyu-io commented 7 years ago

@hansemannn I addressed the reaptCount issue in 91fb999958d7962f06861475628e792032a836da Feel free to let me know your thoughts about the setting repeatCount for playOnce