iOS input not triggering correct animation
Hi ππ» I'm using a Rive file in an iOS app in SwiftUI and I can't get the inputs to work correctly. It's a simple animation that should show a player's score - either +5 or +10. The file has an input called Points
and I'm setting the numeric value to either 5.0
or 10.0
.
I'm using RiveRuntime 6.0.7.
I can send my code, the .riv
file and a screenshot from our designer (once I figure out how to add it here π)
When calling setInput("Points", value: 10.0)
the animation for the value of 5.0
plays but I'm expecting the animation for 10.0
to play π€
Any help would be greatly appreciated! ππ»
I should be able to help you with this. You mentioned that it plays the 5.0 animation. Is that the default animation that would play even if it didn't receive an input? Is the input defined in the main artboard or a nested one?
If you could post the relevant code or a link to GitHub, that'd be great. If possible, could you also include the .rev file?
Thanks for the reply
If I set autoPlay
to true
the 5.0 animation does play immediately.
I've uploaded the .riv file here https://drive.google.com/file/d/1jBg5P5p9OYZat3Z_AMZr9B_kSWBCIg3F/view?usp=sharing (Is the .rev file something else or were you referring to the .riv file?)
I see what's going on now. The problem is actually with the state machine setup, rather than the runtime. Here's a great 101 video explaining how state machines work: https://rive.app/community/doc/state-machine/docwH5zPdh93
In your case, the problem is that the Entry
node only runs once ever. When it plays the 5 Points
animation, it has nowhere else to go.
If you do the same thing, but connect both timelines to the Any State
, it'll run any time Points
reaches 5 or 10.
Let me know if this works for you.