ui-lottie icon indicating copy to clipboard operation
ui-lottie copied to clipboard

Frame support

Open vlowe85 opened this issue 6 years ago • 3 comments

Support setting the progress by frame and playing segments.

I think the following should be available:

setProgressWithFrame(frame)
playFromFrame(startFrame, endFrame)

vlowe85 avatar Feb 07 '19 14:02 vlowe85

Nothing here on readme to achieve that? @itstheceo did a lot of work lately with progress and aligning the plugin with the native SDKs. Maybe he has some info here 👍

bradmartin avatar Mar 01 '19 22:03 bradmartin

This should be possible although some work would have to be done around aligning the underlying APIs as I can't see a uniform way of achieving it from my brief look at comparing LOTAnimationView.m and LottieAnimationView.java

iOS has nice support for this through playFromFrameToFrame seen here

On Android you would probably have to use setMinAndMaxFrame seen here and then subsequently handle playing it afterwards, and resetting things when other APIs are used afterwards. This is the approach I used for playAnimationFromProgressToProgress however I have noticed some issues when using it repeatedly in succession, where the native view can get into illegal states. For example animating from 0 to 50, then from 50 to 40. I need to invest some time into making this more robust but have been busy.

itstheceo avatar Mar 01 '19 23:03 itstheceo

Thanks for the info @itstheceo 😄 much appreciated. If I find time, I'll look into it.

bradmartin avatar Mar 01 '19 23:03 bradmartin