rive-app / rive-flutter

Flutter runtime for Rive
https://rive.app
MIT License
1.16k stars 180 forks source link

SpeedController class speedMultiplier property responds strangely to negative numbers #317

Closed BobaTrek closed 1 year ago

BobaTrek commented 1 year ago

Description

In the Rive editor, when selecting a state in a state machine, on the right side of the editor you can change the speed of the timeline. The default is 1.0x. You can go faster or slower, and positive or negative. If you enter a negative number, the timeline plays backward. Regardless of positive or negative number, the animation plays forever if you have a looping timeline.

In rive-flutter, you can also control the speed of a timeline using the speedMultiplier property of the SpeedController class. It works the same for positive numbers, but negative numbers behave strangely.

Behavior

After first loading a looping animation, if you set the speedMultiplier to a positive number, then the animation plays forward at the set speed forever.

After first loading the animation, if you set the speedMultiplier to a negative number, then the animation does not play at all.

After first loading the animation, if you set the speedMultiplier positive for a while, and then negative, then the animation will play backwards for the same amount of time that you played it forwards, and then stop.

If you continue to play the animation backwards with a negative speedMultiplier, then switching to a positive speedMultiplier won't play any frames until the positive direction catches up to the amount of negative direction the animation had played.

It is as if you can go forward and backwards, but only in positive time. So you can go from 4 seconds to 10 seconds, and 10 seconds to 4 seconds all you want. But you cannot go from say 10 seconds to -10 seconds as the animation will stop at 0.

Expected Behavior

When entering a negative number for the speedMultiplier property of the SpeedController class, the animation should go backwards as in the Rive editor, regardless of having ever been played in the forward direction.

BobaTrek commented 1 year ago

Apparently this bug was fixed with release 0.10.3. I updated to 0.11.1 today and the bug disappeared. I checked the changelog and saw this entry under 0.10.3:

Sorry for the confusion.