Example #1
0
 private ShapeFill(string name, bool fillEnabled, PathFillType fillType, AnimatableColorValue color, AnimatableIntegerValue opacity)
 {
     Name         = name;
     _fillEnabled = fillEnabled;
     FillType     = fillType;
     _color       = color;
     _opacity     = opacity;
 }
Example #2
0
 public ShapeFill(string name, bool fillEnabled, PathFillType fillType, AnimatableColorValue color, AnimatableIntegerValue opacity, bool hidden)
 {
     Name         = name;
     _fillEnabled = fillEnabled;
     FillType     = fillType;
     Color        = color;
     Opacity      = opacity;
     IsHidden     = hidden;
 }
Example #3
0
 private GradientFill(string name, GradientType gradientType, PathFillType fillType, AnimatableGradientColorValue gradientColor, AnimatableIntegerValue opacity, AnimatablePointValue startPoint, AnimatablePointValue endPoint, AnimatableFloatValue highlightLength, AnimatableFloatValue highlightAngle)
 {
     GradientType    = gradientType;
     FillType        = fillType;
     GradientColor   = gradientColor;
     Opacity         = opacity;
     StartPoint      = startPoint;
     EndPoint        = endPoint;
     Name            = name;
     HighlightLength = highlightLength;
     HighlightAngle  = highlightAngle;
 }
        public static AM.FillRule ToSKPathFillType(this PathFillType pathFillType)
        {
            switch (pathFillType)
            {
            default:
            case PathFillType.Winding:
                return(AM.FillRule.NonZero);

            case PathFillType.EvenOdd:
                return(AM.FillRule.EvenOdd);
            }
        }
Example #5
0
 public SolidColorFill(
     string name,
     string matchName,
     PathFillType fillType,
     Animatable <Color> color,
     Animatable <double> opacityPercent)
     : base(name, matchName)
 {
     FillType       = fillType;
     Color          = color;
     OpacityPercent = opacityPercent;
 }
Example #6
0
        internal static SKPathFillType ToSKPathFillType(PathFillType fillType)
        {
            switch (fillType)
            {
            default:
            case PathFillType.Winding:
                return(SKPathFillType.Winding);

            case PathFillType.EvenOdd:
                return(SKPathFillType.EvenOdd);

            case PathFillType.InverseWinding:
                return(SKPathFillType.InverseWinding);

            case PathFillType.InverseEvenOdd:
                return(SKPathFillType.InverseEvenOdd);
            }
        }
        internal static GradientFill Parse(JsonReader reader, LottieComposition composition)
        {
            string name = null;
            AnimatableGradientColorValue color   = null;
            AnimatableIntegerValue       opacity = null;
            GradientType         gradientType    = GradientType.Linear;
            AnimatablePointValue startPoint      = null;
            AnimatablePointValue endPoint        = null;
            PathFillType         fillType        = PathFillType.EvenOdd;

            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "nm":
                    name = reader.NextString();
                    break;

                case "g":
                    int points = -1;
                    reader.BeginObject();
                    while (reader.HasNext())
                    {
                        switch (reader.NextName())
                        {
                        case "p":
                            points = reader.NextInt();
                            break;

                        case "k":
                            color = AnimatableValueParser.ParseGradientColor(reader, composition, points);
                            break;

                        default:
                            reader.SkipValue();
                            break;
                        }
                    }
                    reader.EndObject();
                    break;

                case "o":
                    opacity = AnimatableValueParser.ParseInteger(reader, composition);
                    break;

                case "t":
                    gradientType = reader.NextInt() == 1 ? GradientType.Linear : GradientType.Radial;
                    break;

                case "s":
                    startPoint = AnimatableValueParser.ParsePoint(reader, composition);
                    break;

                case "e":
                    endPoint = AnimatableValueParser.ParsePoint(reader, composition);
                    break;

                case "r":
                    fillType = reader.NextInt() == 1 ? PathFillType.Winding : PathFillType.EvenOdd;
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            return(new GradientFill(
                       name, gradientType, fillType, color, opacity, startPoint, endPoint, null, null));
        }