As mentioned in some recent threads [1] [2], easing functions for
animations have been an example of where functions in the model are
currently used. An alternative approach is to use a union type to indicate
the easing, but a suggested shortcoming of that approach is that there
would then be no way for downstream developers to use their own custom
easings.
I was just thinking that this could be achieved as follows:
```
type AdvancedEasing a
= Linear | InQuad | OutQuad | ...
| CustomEasing a
type alias Easing = AdvancedEasing Never
apply : Easing -> Float -> Float
applyAdvanced : (a -> Float -> Float) -> AdvancedEasing a -> Float -> Float
```
In this way, the custom easing functions (a -> Float -> Float) are moved
from the model to configuration.
I was curious if anyone has experimented with this approach yet.
[1]: https://groups.google.com/d/topic/elm-discuss/bOAHwSnklLc/discussion
[2]: https://groups.google.com/d/topic/elm-discuss/9qV9iDcv-c8/discussion
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.