Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rive animations do not respect TickerMode #187

Closed
goderbauer opened this issue Oct 28, 2021 · 4 comments
Closed

Rive animations do not respect TickerMode #187

goderbauer opened this issue Oct 28, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@goderbauer
Copy link

Description

TickerMode [1] is used in flutter to turn off animations for a subtree. However, it appears that rive is not respecting the setting.

[1] https://master-api.flutter.dev/flutter/widgets/TickerMode-class.html

Steps To Reproduce

Steps to reproduce the behavior:

  1. Wrap the simple animation of the example app with a TickerMode(enabled: false, child: ...):
      TickerMode( // new
        enabled: false, // new
        child: const Center(
          child: RiveAnimation.network(
            'https://cdn.rive.app/animations/vehicles.riv',
            fit: BoxFit.cover,
          ),
        ),
      ), // new
  1. Launch the app, navigate to that example
  2. observe that the animation is still running

Expected behavior

The animation shouldn't be running when TickerMode is off

/cc @dnfield

@goderbauer goderbauer added the bug Something isn't working label Oct 28, 2021
@goderbauer
Copy link
Author

If the animations were to be driven off a AnimationController you'd get this feature for free as AnimationControllers stop ticking when TickerMode is off.

@HayesGordon
Copy link
Contributor

Hi @goderbauer, this should now be resolved in v0.11.14

Thanks for reporting the issue. Please reopen if you encounter an issues.

@jaggernod
Copy link
Contributor

Hey @HayesGordon,
it seems like the issue is not fixed.

The ticker is stopped when ticket mode is disabled on the creation of the render object.
However, afterward, the render object is attached without looking at the tickerModeEnabled.

That leads to just starting the ticker.

@jaggernod
Copy link
Contributor

I have created a small PR.

I have not added a test for the render object as I was not able to find an already existing test for that render object.

I hope that it is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants