mpf-mc icon indicating copy to clipboard operation
mpf-mc copied to clipboard

Custom easing formulas

Open toomanybrians opened this issue 9 years ago • 5 comments

This isn't something that's needed via configs, but we need to figure out how to add custom easing formulas.

Also (possibly related) is we don't have a good way to not use easing today in animations. For example, if you flash a widget, it always fades in and fades out. But what if we just want it to flash instant on / instant off? Maybe this is done with an easing type called "instant" which just instantly sets the eased attribute to the new value? (This could be an example of a custom easing formula.)

toomanybrians avatar Sep 21 '16 06:09 toomanybrians

Is it ok to monkeypatch Kivy's AnimationTransition to add new static methods?

https://github.com/kivy/kivy/blob/master/kivy/animation.py#L528

I can't think of any easier way, but I think monkeypatching is frowned upon? Though in this case, MPF and Kivy are so tightly intertwined that it's probably safe?

toomanybrians avatar Sep 21 '16 20:09 toomanybrians

Can we just overload the class? Like create MpfAnimationTransition and add the methods there?

jabdoa2 avatar Sep 21 '16 20:09 jabdoa2

problem with that is that kivy uses its class, and the class above that uses its class, and so on all the way up. We can discuss in chicago I guess..

toomanybrians avatar Sep 21 '16 20:09 toomanybrians

Looks like bad design on their side. Then we have to monkey patch unfortunately.

jabdoa2 avatar Sep 21 '16 20:09 jabdoa2

I have discovered the Kivy Animation class will either accept a string for the transition argument or a function reference so using a custom animation method is as easy as passing in a function reference to a custom easing function.

qcapen avatar May 18 '17 19:05 qcapen