This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74b26eb
commit 4ed4f05
Showing
2 changed files
with
140 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Summary | ||
|
||
The API for the animation package changed significantly from Elm 0.17 to Elm 0.18. | ||
|
||
This document is an effort to document the details. | ||
|
||
## Imports | ||
|
||
### Adding Imports | ||
|
||
* Animation | ||
|
||
### Removing Imports | ||
|
||
* AnimationFrame | ||
* Style | ||
* Style.Properties | ||
|
||
## Model | ||
|
||
* Old State Type: `Style.Animation` | ||
* New State Type: `Animation.State` | ||
|
||
## Init | ||
|
||
* Old State Assignment: `Style.init []` | ||
* New State Assignment: `Animation.style []` | ||
|
||
**Note:** Same for `initWithInfo` | ||
|
||
## Subscription | ||
|
||
* Old Subscription: `AnimationFrame.times Animate` | ||
* New Subscription: `Animation.subscription Animate <| [model.svgStyle]` | ||
|
||
## Update | ||
|
||
Several changes here. | ||
|
||
### `Animate time ->`: | ||
|
||
Old: | ||
|
||
```elm | ||
( { model | ||
| svgStyle = Style.tick time model.svgStyle | ||
} | ||
, Cmd.none | ||
) | ||
``` | ||
|
||
--- | ||
|
||
New: | ||
|
||
```elm | ||
( onStyle model <| | ||
Animation.update time | ||
, Cmd.none | ||
) | ||
``` | ||
|
||
where | ||
|
||
```elm | ||
onStyle : Model -> (Animation.State -> Animation.State) -> Model | ||
onStyle model styleFn = | ||
{ model | svgStyle = styleFn <| model.svgStyle } | ||
``` | ||
|
||
### `Move Location ->` | ||
|
||
Old: | ||
|
||
```elm | ||
let | ||
newModel = | ||
moveLoc location model | ||
|
||
newModel2 = | ||
{ newModel | ||
| svgStyle = | ||
Style.animate | ||
|> Style.to (getSvgValues newModel) | ||
|> Style.on (setSvgStyle model) | ||
} | ||
in | ||
( newModel2, Cmd.none ) | ||
``` | ||
|
||
--- | ||
|
||
New: | ||
|
||
```elm | ||
( onStyle model <| | ||
Animation.interrupt | ||
[ Animation.to | ||
[ Animation.translate ] | ||
] | ||
, Cmd.none | ||
) | ||
``` |