Beispiel #1
0
        internal FillContent(LottieDrawable lottieDrawable, BaseLayer layer, ShapeFill fill)
        {
            Name            = fill.Name;
            _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 = (KeyframeAnimation <int?>)fill.Opacity.CreateAnimation();
            _opacityAnimation.ValueChanged += (sender, args) =>
            {
                _lottieDrawable.InvalidateSelf();
            };
            layer.AddAnimation(_opacityAnimation);
        }
Beispiel #2
0
 internal StrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, ShapeStroke stroke) : base(lottieDrawable, layer, ShapeStroke.LineCapTypeToPaintCap(stroke.CapType), ShapeStroke.LineJoinTypeToPaintLineJoin(stroke.JoinType), stroke.Opacity, stroke.Width, stroke.LineDashPattern, stroke.DashOffset)
 {
     Name            = stroke.Name;
     _colorAnimation = (KeyframeAnimation <Color>)stroke.Color.CreateAnimation();
     _colorAnimation.ValueChanged += OnValueChanged;
     layer.AddAnimation(_colorAnimation);
 }
        internal GradientStrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, GradientStroke stroke) : base(lottieDrawable, layer, ShapeStroke.LineCapTypeToPaintCap(stroke.CapType), ShapeStroke.LineJoinTypeToPaintLineJoin(stroke.JoinType), stroke.Opacity, stroke.Width, stroke.LineDashPattern, stroke.DashOffset)
        {
            Name        = stroke.Name;
            _type       = stroke.GradientType;
            _cacheSteps = (int)(lottieDrawable.Composition.Duration / CacheStepsMs);

            _colorAnimation = (KeyframeAnimation <GradientColor>)stroke.GradientColor.CreateAnimation();
            _colorAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_colorAnimation);

            _startPointAnimation = (KeyframeAnimation <PointF>)stroke.StartPoint.CreateAnimation();
            _startPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_startPointAnimation);

            _endPointAnimation = (KeyframeAnimation <PointF>)stroke.EndPoint.CreateAnimation();
            _endPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_endPointAnimation);
        }
        internal GradientFillContent(LottieDrawable lottieDrawable, BaseLayer layer, GradientFill fill)
        {
            Name            = fill.Name;
            _lottieDrawable = lottieDrawable;
            _type           = fill.GradientType;
            _path.FillType  = fill.FillType;
            _cacheSteps     = (int)(lottieDrawable.Composition.Duration / CacheStepsMs);

            _colorAnimation = (KeyframeAnimation <GradientColor>)fill.GradientColor.CreateAnimation();
            _colorAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_colorAnimation);

            _opacityAnimation = (KeyframeAnimation <int?>)fill.Opacity.CreateAnimation();
            _opacityAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_opacityAnimation);

            _startPointAnimation = (KeyframeAnimation <PointF>)fill.StartPoint.CreateAnimation();
            _startPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_startPointAnimation);

            _endPointAnimation = (KeyframeAnimation <PointF>)fill.EndPoint.CreateAnimation();
            _endPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_endPointAnimation);
        }
Beispiel #5
0
 internal SplitDimensionPathKeyframeAnimation(KeyframeAnimation <float?> xAnimation, KeyframeAnimation <float?> yAnimation)
     : base(new List <IKeyframe <Vector2?> >())
 {
     _xAnimation = xAnimation;
     _yAnimation = yAnimation;
 }