rive-app / rive-wasm

Wasm/JS runtime for Rive
MIT License
660 stars 46 forks source link

Listeners only registered if state machines are playing (autostart) #309

Closed FlorianPAZE closed 1 year ago

FlorianPAZE commented 1 year ago

Description

In the example shown below, we have set autoplay to false, in order to start the playback after the "Okay" button is clicked. However, doing so, the state machine does in fact start playing - however the listeners for hover and click that we have on the state machine are not registered and don't work anymore. Setting the autplay to true works just fine.

Provide a Repro

This example shows the issue: https://codepen.io/florianpaze/pen/abRpbaQ/479047d396a701b7c996a2a344185dbb

Source .riv/.rev file

(.riv file is linked in the codepen JS)

Expected behavior

Even if autoplay is set to false, the listeners should be properly registered, so that we can use playback controls after the fact without loosing the listener interactions.

zplata commented 1 year ago

@FlorianPAZE - try upgrading the runtime lib to @rive-app/canvas: 1.1.5. This ensures that if you set autoplay: false and start play() with a state machine, Rive Listeners should be enabled.

zplata commented 1 year ago

Closing for now but feel free to re-open the issue if you still have issues with this!