You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module gives you animated `Html` `div`s out of the box, and some helpers to create animated versions of whatever `UI` library you're using.
14
14
15
-
e.g. You want animated `elm-ui` `Element`s? Create an animated helper like this:
16
-
17
-
animatedUi =
18
-
Simple.Animated.ui
19
-
{ behindContent = Element.behindContent
20
-
, htmlAttribute = Element.htmlAttribute
21
-
, html = Element.html
22
-
}
23
-
24
-
Then make animated `el`s, `column`s and `row`s!
25
-
26
-
el : Animation -> List (Element.Attribute msg) -> Element msg -> Element msg
27
-
el =
28
-
animatedUi Element.el
29
-
30
-
Then render an animation
31
-
32
-
dot : Element msg
33
-
dot =
34
-
Utils.Animated.el expandFade [] elmUiDot
35
-
36
15
37
16
## Common Helpers
38
17
39
-
You can find many of these common helpers here: <https://github.com/andrewMacmurray/elm-simple-animation/blob/main/examples/src/Utils/Animated.elm>
18
+
You can find examples of building many of the common helpers mentioned below: <https://github.com/andrewMacmurray/elm-simple-animation/blob/main/examples/src/Utils/Animated.elm>
40
19
41
20
42
21
# Html Animations
@@ -46,69 +25,16 @@ You can find many of these common helpers here: <https://github.com/andrewMacmur
46
25
47
26
# Hook Into SVG
48
27
49
-
So you can use whatever version of `elm/svg` you like use the `Simple.Animated.svg` function along with `Svg.Attributes.class` to create animated `Svg` elements:
50
-
51
-
g : Animation -> List (Svg.Attribute msg) -> List (Svg msg) -> Svg msg
52
-
g =
53
-
animatedSvg Svg.g
54
-
55
-
animatedSvg =
56
-
Simple.Animated.node Svg.Attributes.class
57
-
58
-
Then render an animation
59
-
60
-
dot : Svg msg
61
-
dot =
62
-
Svg.svg []
63
-
[ Utils.Animated.g expandFade [] [ svgDot ]
64
-
]
65
-
66
28
@docs svg
67
29
68
30
69
31
# Hook Into Elm UI
70
32
71
-
Create animated `elm-ui` `Element`s
72
-
73
-
el : Animation -> List (Element.Attribute msg) -> Element msg -> Element msg
74
-
el =
75
-
animatedUi Element.el
76
-
77
-
animatedUi =
78
-
Simple.Animated.ui
79
-
{ behindContent = Element.behindContent
80
-
, htmlAttribute = Element.htmlAttribute
81
-
, html = Element.html
82
-
}
83
-
84
-
Then render an animation
85
-
86
-
dot : Element msg
87
-
dot =
88
-
Utils.Animated.el expandFade [] elmUiDot
89
-
90
33
@docs UiOptions, ui
91
34
92
35
93
36
# Custom Renderer
94
37
95
-
When you want to completely customise how to render animations you can use the low level `Simple.Animated.custom` - which gives you access to the raw animation `stylesheet` and `class` name that will apply the animation.
96
-
97
-
For example, say you wanted to animate `elm-community/typed-svg` nodes - you could create animated versions like this:
98
-
99
-
g : Animation -> List (TypedSvg.Attribute msg) -> List (TypedSvg.Svg msg) -> TypedSvg.Svg msg
100
-
g =
101
-
animatedTypedSvg TypedSvg.g
102
-
103
-
animatedTypedSvg node animation attributes children =
{-| So you can use whatever version of `elm/svg` you like use the `Simple.Animated.svg` function along with `Svg.Attributes.class` to create animated `Svg` elements:
98
+
99
+
animatedSvg =
100
+
Simple.Animated.node Svg.Attributes.class
101
+
102
+
Then render an animation
103
+
104
+
dot : Svg msg
105
+
dot =
106
+
Svg.svg []
107
+
[ g expandFade [] [ svgDot ]
108
+
]
109
+
110
+
g : Animation -> List (Svg.Attribute msg) -> List (Svg msg) -> Svg msg
@@ -201,7 +144,26 @@ type alias UiOptions element attribute msg =
201
144
}
202
145
203
146
204
-
{-| -}
147
+
{-| Create animated `elm-ui` `Element`s
148
+
149
+
animatedUi =
150
+
Simple.Animated.ui
151
+
{ behindContent = Element.behindContent
152
+
, htmlAttribute = Element.htmlAttribute
153
+
, html = Element.html
154
+
}
155
+
156
+
Then render an animation
157
+
158
+
dot : Element msg
159
+
dot =
160
+
el expandFade [] elmUiDot
161
+
162
+
el : Animation -> List (Element.Attribute msg) -> Element msg -> Element msg
163
+
el =
164
+
animatedUi Element.el
165
+
166
+
-}
205
167
ui:
206
168
UiOptions element attribute msg
207
169
->(List attribute -> children -> element)
@@ -230,7 +192,24 @@ type alias Stylesheet =
230
192
String
231
193
232
194
233
-
{-| -}
195
+
{-| When you want to completely customise how to render animations you can use the low level `Simple.Animated.custom`. This gives you access to the raw animation `stylesheet` and `class` name that will apply the animation.
196
+
197
+
For example, say you wanted to animate `elm-community/typed-svg` nodes - you could create animated versions like this:
198
+
199
+
g : Animation -> List (TypedSvg.Attribute msg) -> List (TypedSvg.Svg msg) -> TypedSvg.Svg msg
200
+
g =
201
+
animatedTypedSvg TypedSvg.g
202
+
203
+
animatedTypedSvg node animation attributes children =
0 commit comments