Closed jasonwurzel closed 6 years ago
It changed in 2.5.0. I'm using the same approach as the official repo (http://airbnb.io/lottie/android/dynamic.html). I double checked and there was a bug preventing the Color dynamic animations. Fixed! (https://github.com/azchohfi/LottieUWP/commit/ae9f6430252750a321930ebd6284b9e1928649bd)
You should do something similar to this:
LottieAnimationView.AddValueCallback(new KeyPath("**"),
LottieProperty.StrokeColor,
new CustomColorProgressCallback());
class CustomColorProgressCallback : LottieValueCallback<Color?>
{
public override Color? GetValue(float startFrame, float endFrame, Color? startValue, Color? endValue, float linearKeyframeProgress,
float interpolatedKeyframeProgress, float overallProgress)
{
return overallProgress < 0.5 ? Colors.Green : Colors.Red;
}
}
Thank you so much for your fast response! When will you push a new nuget package?
I'm targeting for today!
Hi,
first of all: thank you for that great port of lottie. It's coming in very handy for animating icons etc. One question I have though: The official docs say, for replacing Colors one should use the ...addColorFilter methods. But it seems as if those methods were once a part of LottieUWP's LottieAnimationView but are no more ( http://airbnb.io/lottie/android/colors.html ). How do I change colors then? As I'm having a dark theme and a light theme I would have to have duplicate versions for every animation (one dark, one light). Thank you very much, Michael