diff --git a/.rive_head b/.rive_head index 3f2cfc57..aa9da2a1 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -14dcaa0cdedd07c92b77bc013567251ffc29b2c6 +d5271145212650f72b01b239afb4f5607ee1a9b6 diff --git a/Source/RiveView.swift b/Source/RiveView.swift index 2093e930..8824685a 100644 --- a/Source/RiveView.swift +++ b/Source/RiveView.swift @@ -355,15 +355,19 @@ open class RiveView: RiveRendererView { RiveLogger.log(view: self, event: .eventReceived(event.name())) stateMachineDelegate?.onRiveEventReceived?(onRiveEvent: event) } - } - isPlaying = stateMachine.advance(by: delta) && wasPlaying - + } + var shouldAdvance = stateMachine.advance(by: delta) + if delta == 0 { + shouldAdvance = true + } + isPlaying = shouldAdvance && wasPlaying + if let delegate = stateMachineDelegate { stateMachine.stateChanges().forEach { delegate.stateMachine?(stateMachine, didChangeState: $0) } } } else if let animation = riveModel?.animation { isPlaying = animation.advance(by: delta) && wasPlaying - + if isPlaying { if animation.didLoop() { playerDelegate?.player(loopedWithModel: riveModel, type: Int(animation.loop())) diff --git a/Tests/RiveDelegatesTest.swift b/Tests/RiveDelegatesTest.swift index 29b5ea73..b4152ba8 100644 --- a/Tests/RiveDelegatesTest.swift +++ b/Tests/RiveDelegatesTest.swift @@ -342,7 +342,7 @@ class DelegatesTest: XCTestCase { XCTAssertEqual(delegate.stateMachineStates[1], "ExitState") // takes an extra advance to trigger - view.advance(delta:0) + view.advance(delta:0.1) XCTAssertEqual(delegate.stateMachinePauses.count, 1) }