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.16k stars 197 forks source link

Fix wrong order of lerp when parsing of color stops #324

Closed idlewan closed 9 months ago

idlewan commented 9 months ago

The _getColorInBetweenColorStops interpolated between color stops with the order of stops inverted between the two it should interpolate with (comparing with _getColorInBetweenOpacityStops confirms this as well). This means that if there is more than two stops in the gradient, the second color in the gradient never appears and the third one takes its place, and the colors are on the wrong stop after that.

Before fix

image

After fix

image

File: gradients_multiple_stops.json

xvrh commented 9 months ago

Thanks a lot for your contribution!