Skip to content

Commit

Permalink
return keep going when a state machine has changed its state
Browse files Browse the repository at this point in the history
previously, when an animation advanced by 0 seconds, it would return true, which was interpreted as meaning that the animation needed to keep advancing.
We changed that behavior and now a linear animation will return false if it didn't advance.
A side effect of that is that now the animation state that calls advance, sets keepGoing to false instead of true.
So the animation wouldn't keep going in that frame.
Which is ok as long as we add a new condition to identify whether the state machine layer should keep going in the next frame based on whether it changed its state internally.
This PR adds that condition

Diffs=
51c3bbcde2 return keep going when a state machine has changed its state (#8564)

Co-authored-by: hernan <[email protected]>
  • Loading branch information
bodymovin and bodymovin committed Nov 15, 2024
1 parent 3699cef commit 00b07f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
50e31c53f0cf563f0291cafb4091a7657e94f3a9
51c3bbcde2dbd0c07d63ca2d1569f53aba668c23
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ class RiveListenerTest {

// as before lets advance beyond the end of the animation, in this case change to exit!
renderer.advance(1.0f)
// will return true because there was a change of state with this last advance
assertEquals(true, view.isPlaying)
renderer.advance(0.1f)

assertEquals(false, view.isPlaying)
assertEquals(1, observer.states.size)
assertEquals(true, observer.states[0].stateName == "ExitState")
Expand Down
2 changes: 1 addition & 1 deletion submodules/rive-runtime

0 comments on commit 00b07f9

Please sign in to comment.