extension-rive icon indicating copy to clipboard operation
extension-rive copied to clipboard

Change to synchronous playback of animations

Open igorhart opened this issue 4 years ago • 3 comments

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)

igorhart avatar Oct 14 '21 19:10 igorhart

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)

britzl avatar Oct 18 '21 09:10 britzl

We should change rive.play_state_machine() so that it is sync and completes immediately

britzl avatar Oct 18 '21 09:10 britzl

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)

JCash avatar Oct 18 '21 09:10 JCash