This is surprisingly involved and part of it is I suspect that a proper transition library specifically designed around elm-ui is (AFAICT) still missing.
The basics steps are like this:
- Define properties for the start and mouseOver states.
- Figure out which properties these correspond to in elm-simple-animation.
- Add a transition for those.
Element.Input.button
[ Background.color (Element.rgb 0.5 0.5 0.6)
, Element.mouseOver
[ Background.color (Element.rgb 0.7 0.7 1)
]
, Transition.properties
[ Transition.backgroundColor 500 []
]
|> Element.htmlAttribute
]
{ onPress = Nothing
, label = Element.text "Hello"
}
You can see a working example here.