Function `to` is expecting the argument to be: Float
Closed this issue · 1 comments
When I try to compile my app, I get the following error:
The 1st argument to function `interrupt` is causing a mismatch. - Function `interrupt` is expecting the 1st argument to be:
List (Animation.Model.Step msg)
But it is:
List (Animation.Animation -> Animation.Animation)
Hint: It looks like a function needs 1 more argument.
~~~
List (Animation.Model.Step msg) -> Animation.Model.Animation msg -> Animation.Model.Animation msg
~~~
Interrupt any running animations with the following animation.
The code is
newModel = { model | cardStyle = Animation.interrupt [ Animation.to styles.disliked ] model.cardStyle }
type alias Model = { ... , cardStyle : Animation.State }
styles = { disliked = [ Animation.left (px -100.0) , Animation.opacity 0 ] , normal = [ Animation.left (px 0) , Animation.opacity 1.0 ] }
Any ideas?
Best
Hmm, not sure. The error message and the code you posted don't seem to be in agreement. The error is saying that interrupt
needs a list of Animation steps and then an animation state, but somewhere you're giving it a list of (Animation->Animation) functions.
I'm going to close this as I don't think it's an issue with the library, but I also don't want to leave you hangin :). Check out the elm slack, either the #animations or the #help channel.
Another way to debug this would be to write out the animation concretely in one chunk.
Something like:
newModel =
{ model
| cardStyle =
Animation.interrupt
[ Animation.to
[ Animation.left (px -100.0)
, Animation.opacity 0
]
]
model.cardStyle
}
Feel free to comment here if you are still running into issues after playing around with it and after asking the community.
Best