That's an interesting approach, though I'm not sure it would work for 
elm-style-animation, at least in its current form.   In elm-style-animation 
you compose an animation under one Msg, and send animation 
updates(basically tick the animation forward) via a separate Msg.  

The `apply` and `applyAdvanced` functions would have to live in the 
animation update Msg in order for them to work and not store anything in a 
model, but choosing an easing is conceptually part of composing an 
animation, not updating it. 
As a sidenote, an animation in elm-style-animation can have any number of 
separate easings used in different stages of the animation.  This 
complicates things a bit for an implementation.

```
Animation.interrupt
     [ Animation.toWith {duration=(1*second), easing=identity)}
                [opacity 0]
    , Animation.toWith {duration=(1*second), easing=(\x -> x^2)}
                [opacity 0]
    ]

```






On Thursday, October 13, 2016 at 2:29:19 AM UTC-4, Aaron VonderHaar wrote:
>
> 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.

Reply via email to