-
Notifications
You must be signed in to change notification settings - Fork 1
/
FlipDemo.elm
41 lines (35 loc) · 1.06 KB
/
FlipDemo.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Html exposing (Html)
import Html.Attributes as Html
import Time exposing (Time)
import Animation exposing (..)
import Color exposing (Color)
import Easing
yellowCircle : Float -> Html
yellowCircle alpha =
Html.img
[ Html.src "yellowCircle.png"
, Html.style [("opacity", toString alpha)]
] []
box : Int -> Color -> Html
box size color =
let
style =
[ background color
, width size
, height size
]
in
Html.div [Html.style style] []
render time model =
let
ease = animateOnOff time model
in
Html.div []
[ box (ease easeInt 250 40) (ease Easing.color Color.blue Color.red)
, yellowCircle (ease Easing.float 0 1)
]
init = onOffAnimationState True
step (time,a) model = case (currentOnOffTargetValue model) of
True -> startOnOffAnimation Easing.easeInOutQuad 700 0 time False model
False -> startOnOffAnimation Easing.easeInOutQuad 700 0 time True model
main = animationSignal init step render (isActive) (Time.every 1000)