internal FillContent(ILottieDrawable lottieDrawable, BaseLayer layer, ShapeFill fill)
        {
            _layer          = layer;
            Name            = fill.Name;
            _hidden         = fill.IsHidden;
            _lottieDrawable = lottieDrawable;
            if (fill.Color == null || fill.Opacity == null)
            {
                _colorAnimation   = null;
                _opacityAnimation = null;
                return;
            }

            _path.FillType = fill.FillType;

            _colorAnimation = fill.Color.CreateAnimation();
            _colorAnimation.ValueChanged += (sender, args) =>
            {
                _lottieDrawable.InvalidateSelf();
            };
            layer.AddAnimation(_colorAnimation);
            _opacityAnimation = fill.Opacity.CreateAnimation();
            _opacityAnimation.ValueChanged += (sender, args) =>
            {
                _lottieDrawable.InvalidateSelf();
            };
            layer.AddAnimation(_opacityAnimation);
        }
 public void AddValueCallback <T>(LottieProperty property, ILottieValueCallback <T> callback)
 {
     if (property == LottieProperty.Color)
     {
         _colorAnimation.SetValueCallback((ILottieValueCallback <SKColor?>)callback);
     }
     else if (property == LottieProperty.Opacity)
     {
         _opacityAnimation.SetValueCallback((ILottieValueCallback <int?>)callback);
     }
     else if (property == LottieProperty.ColorFilter)
     {
         if (callback == null)
         {
             _colorFilterAnimation = null;
         }
         else
         {
             _colorFilterAnimation = new ValueCallbackKeyframeAnimation <SKColorFilter, SKColorFilter>((ILottieValueCallback <SKColorFilter>)callback);
             _colorFilterAnimation.ValueChanged += (sender, args) =>
             {
                 _lottieDrawable.InvalidateSelf();
             };
             _layer.AddAnimation(_colorFilterAnimation);
         }
     }
 }
        internal ContentGroup(ILottieDrawable lottieDrawable, BaseLayer layer, string name, bool hidden, List <IContent> contents, AnimatableTransform transform)
        {
            Name      = name;
            _hidden   = hidden;
            _contents = contents;

            if (transform != null)
            {
                _transformAnimation = transform.CreateAnimation();

                _transformAnimation.AddAnimationsToLayer(layer);
                _transformAnimation.ValueChanged += (sender, args) =>
                {
                    lottieDrawable.InvalidateSelf();
                };
            }

            var greedyContents = new List <IGreedyContent>();

            for (var i = contents.Count - 1; i >= 0; i--)
            {
                var content = contents[i];
                if (content is IGreedyContent greedyContent)
                {
                    greedyContents.Add(greedyContent);
                }
            }

            for (var i = greedyContents.Count - 1; i >= 0; i--)
            {
                greedyContents[i].AbsorbContent(_contents);
            }
        }
 private void Invalidate()
 {
     _isPathValid = false;
     _lottieDrawable.InvalidateSelf();
 }
 private void OnValueChanged(object sender, EventArgs eventArgs)
 {
     _lottieDrawable.InvalidateSelf();
 }