Thread
B
30d ago
Confuse about rive playing method, on iOS
I'm new in Rive. And I want to use Rive on iOS, but something confusing me.
When I play a animation that created with loop mode `One Shot`, with following code:
rViewModel.play(animationName: "animation_name", loop: .pingPong, direction: .autoDirection)
But the animate still playing in `oneshot` mode ???
Environment:
iOS 18.0;
RiveRuntime v6.5.11, from SPM
Did I do something wrong ?
Here is the comment of the method:
/// Starts the active Animation or StateMachine from it's last position. It will start /// from the beginning if the active Animation has ended or a new one is provided. /// - Parameters: /// - animationName: The name of a new Animation to play on the current Artboard /// - loop: The loop mode for the active Animation @objc open func play(animationName: String? = nil, loop: RiveLoop = .autoLoop, direction: RiveDirection = .autoDirection)
1 reply
D
D
(edited) 27d ago
What does your usage of the RiveViewModel
initializer(s) look like? In my testing, it seems to ping pong if I do something like
RiveViewModel(fileName: "your_file_here", animationName: "Timeline 1", autoPlay: false)
which, for this case, bypasses the loading of any state machines you have in the file.