extension-rive
extension-rive copied to clipboard
Change to synchronous playback of animations
Currently, it is possible to set the value of state machine input like this:
-- Set the value of the "progress" input to 50
go.set("#model", "progress", 50)
but there is no way to animate the change from the current value to 50, like this:
-- Animate the value of the "progress" input to 50
go.animate("#model", "progress", go.PLAYBACK_ONCE_FORWARD, 50, go.EASING_LINEAR, 1, 0, callback)
It works but rive.play_state_machine() is async (uses message passing internally) which means that you need to wait until the play_state_machine() call has been processed before you animate the state machine value. Like this:
rive.play_state_machine("#model", "State Machine 1")
timer.delay(0, false, function()
go.animate("#model", hash("Number 1"), go.PLAYBACK_LOOP_PINGPONG, 90, go.EASING_LINEAR, 1)
end)
We should change rive.play_state_machine() so that it is sync and completes immediately
We'll keep this ticket, as our goal it to make it so that the rive.play_animation() is synchronous, and that will allow for the get/set of properties of the rive component (animation is using get/set)