rive-app / rive-ios

iOS runtime for Rive
MIT License
462 stars 53 forks source link

How to handle the completion of animation playback in SwiftUI #284

Closed Masataka-n closed 8 months ago

Masataka-n commented 8 months ago

Description

Is there a way to detect the completion of animation playback in SwiftUI? Help appreciate, thanks!

HayesGordon commented 8 months ago

Hi @Masataka-n you can listen to certain animation state changes that occur, see Player Delegates

But the new and better way is to make use of Rive Events. You can "report" any custom Rive event from a state machine. For example, when a button is pressed, or when an animation finishes, or at any point information needs to be sent from the animation to the runtime.

Take a look at our docs for events here: https://help.rive.app/runtimes/rive-events

Closing this issue for now. Feel free to reach out to us on Discord if you have implementation questions.