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

Animation Control Problem For Blend One In State Machine (Flutter)

Open BlockRen opened this issue 1 year ago • 3 comments

Description:

I've encountered an issue with the control of animations in my Flutter project that the animation is blend in state machine animation.

Animation Implementation Details:

  • The .riv files utilize a state machine to manage the animation flow.
  • Number inputs are employed to control the transitions within the animation flow.
  • Some states within the state machine are blends, which are mixtures of two regular Timeline animations.

Steps to Reproduce the Issue:

  • Retrieve the state machine animation's input using SMINumber.
  • Change the value by calling 'ctrl.value'.
  • While regular timeline animations play as expected, the blend animations do not respond and show no signs of playback.

Reproduction Environment:

Development Environment:

  • MacOS Sonoma 14.5
  • Android Studio Koala Feature Drop | 2024.1.2
  • Device: Pixel 4a 5G Android Version 14
  • Flutter Environment: Flutter 3.22.2 • channel stable Framework • revision 761747bfc5 (3 months ago) • 2024-06-05 22:15:13 +0200 Engine • revision edd8546116 Tools • Dart 3.4.3 • DevTools 2.34.3

Expected Behavior:

The blend animations should play smoothly alongside the regular timeline animations when the .value is changed.

Actual Behavior:

The blend animations do not play at all, and there is no visual or console output indicating an error.

I would appreciate any guidance or assistance in resolving this issue. Thank you for your time and support.

BlockRen avatar Sep 10 '24 04:09 BlockRen

I've identified the core issue: it seems that while timeline animations work fine immediately after initializing the Rive object, blend animations fail to execute unless called after a delay, eg: 1 second. This suggests that blend animations might still be asynchronously initializing after the Rive object is ready, requiring a delayed invocation.

BlockRen avatar Sep 10 '24 05:09 BlockRen

Hi @BlockRen , it'll be helpful if you can share a .rev/.riv file alongside sample code you're using so that we can investigate this more easily.

HayesGordon avatar Sep 10 '24 08:09 HayesGordon

We had similar issue with blend animations where setting an input number value would not show correct state in app (e.g. editor worked correctly, but setting 50 in the flutter SMINumber would look like 70). From the description above it seems we encountered the same or very similar issue. The issue was present in rive 0.13.1 but is not happening in rive 0.13.15.

screenshot_20241030_123120

orestesgaolin avatar Oct 30 '24 11:10 orestesgaolin

Thank you for sharing @orestesgaolin.

@BlockRen I will assume that this is resolved in the latest version. Please feel free to reopen this issue and share a reproducible example so that we can investigate.

HayesGordon avatar Nov 15 '24 17:11 HayesGordon