xvrh / lottie-flutter

Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
https://pub.dev/packages/lottie
MIT License
1.13k stars 197 forks source link

RenderCache as Raster initializes animation with incorrect state #332

Open lucas404x opened 6 months ago

lucas404x commented 6 months ago

In my app I created an AnimationController to manually handle the animation state.

 enum _FingerprintButtonLottieState {
  initial(0),
  clicked(.36),
  successBiometricTarget(.85);

  const _FingerprintButtonLottieState(this.target);
  final double target;
}
...

_buttonController = AnimationController(
   vsync: this,
   duration: const Duration(seconds: 1),
);
...

FadeScaleTransition(
                animation: _fadeInController,
                child: Lottie.asset(
                  ProdigyAssets.fingerprintButtonAnimation,
                  renderCache: RenderCache.raster,
                  controller: _buttonController,
                  height: 48,
                  onLoaded: (_) {
                    _fadeInController.forward();
                    _enableButton = backgroundUpdater.state.isUpdaterFinished;
                  },
                ),
              )

When I set RenderCache as 'Raster' the animation initial state looks like this: image

But when I remove or replace it with the 'DrawingCommands' option, this is the animation initial state (the right one): image

Check this link to see the animation.

xvrh commented 6 months ago

I'll take a look. Thanks for the report