flet icon indicating copy to clipboard operation
flet copied to clipboard

Explicit animations with fine control: chain, cancel, reverse, pause

Open mikaelho opened this issue 3 years ago • 2 comments

Once you have any animations, you typically run into the following use cases, in decreasing order of importance (my opinion):

  1. Run several animations in parallel

    I assume this is the base case and will be supported by default

  2. Chaining animations, i.e. start another as soon as the first one finishes (maybe with a delay)

    Could be supported with an event, but with the potential for network delay, perfect animations could probably not rely on that.

  3. Canceling an animation, e.g. when user clicks a button

    Python API would need a reference to the running animation.

  4. Running the same animation back and forth

  5. Pausing an animation with an option to continue (needs a reference, again)

mikaelho avatar Aug 10 '22 04:08 mikaelho

Yes, this is called in Flutter terms "explicit" animations: https://www.youtube.com/watch?v=GXIJJkq_H8g What is currently implemented in Flet (and should be documented) are "implicit" animations.

Cancelling, pausing, back/forth are all responsibilities of AnimationController which I was planning to expose in Flet API.

FeodorFitsner avatar Aug 10 '22 16:08 FeodorFitsner

Thanks, good to hear. Looks like AnimationController has a addStatusListener that can be used to create events to Python, e.g. when the animation ends.

mikaelho avatar Aug 11 '22 14:08 mikaelho