Ejemplo n.º 1
0
            internal static ShapeFill NewInstance(JsonObject json, LottieComposition composition)
            {
                AnimatableColorValue color = null;
                bool fillEnabled;
                AnimatableIntegerValue opacity = null;
                var name = json.GetNamedString("nm");

                var jsonColor = json.GetNamedObject("c", null);

                if (jsonColor != null)
                {
                    color = AnimatableColorValue.Factory.NewInstance(jsonColor, composition);
                }

                var jsonOpacity = json.GetNamedObject("o", null);

                if (jsonOpacity != null)
                {
                    opacity = AnimatableIntegerValue.Factory.NewInstance(jsonOpacity, composition);
                }
                fillEnabled = json.GetNamedBoolean("fillEnabled", false);

                var fillTypeInt = (int)json.GetNamedNumber("r", 1);
                var fillType    = fillTypeInt == 1 ? PathFillType.Winding : PathFillType.EvenOdd;

                return(new ShapeFill(name, fillEnabled, fillType, color, opacity));
            }
 internal AnimatableTextProperties(AnimatableColorValue color, AnimatableColorValue stroke, AnimatableFloatValue strokeWidth, AnimatableFloatValue tracking)
 {
     _color       = color;
     _stroke      = stroke;
     _strokeWidth = strokeWidth;
     _tracking    = tracking;
 }
Ejemplo n.º 3
0
 private ShapeFill(string name, bool fillEnabled, PathFillType fillType, AnimatableColorValue color, AnimatableIntegerValue opacity)
 {
     Name         = name;
     _fillEnabled = fillEnabled;
     FillType     = fillType;
     _color       = color;
     _opacity     = opacity;
 }
Ejemplo n.º 4
0
 private ShapeStroke(string name, AnimatableFloatValue offset, IList <AnimatableFloatValue> lineDashPattern, AnimatableColorValue color, AnimatableIntegerValue opacity, AnimatableFloatValue width, LineCapType capType, LineJoinType joinType)
 {
     Name            = name;
     DashOffset      = offset;
     LineDashPattern = lineDashPattern;
     Color           = color;
     Opacity         = opacity;
     Width           = width;
     CapType         = capType;
     JoinType        = joinType;
 }
            internal static AnimatableTextProperties NewInstance(JsonObject json, LottieComposition composition)
            {
                if (json == null || !json.ContainsKey("a"))
                {
                    return(new AnimatableTextProperties(null, null, null, null));
                }

                var animatablePropertiesJson = json.GetNamedObject("a");

                var colorJson = animatablePropertiesJson.GetNamedObject("fc", null);
                AnimatableColorValue color = null;

                if (colorJson != null)
                {
                    color = AnimatableColorValue.Factory.NewInstance(colorJson, composition);
                }

                var strokeJson = animatablePropertiesJson.GetNamedObject("sc", null);
                AnimatableColorValue stroke = null;

                if (colorJson != null)
                {
                    stroke = AnimatableColorValue.Factory.NewInstance(strokeJson, composition);
                }

                var strokeWidthJson = animatablePropertiesJson.GetNamedObject("sw", null);
                AnimatableFloatValue strokeWidth = null;

                if (strokeWidthJson != null)
                {
                    strokeWidth = AnimatableFloatValue.Factory.NewInstance(strokeWidthJson, composition);
                }

                var trackingJson = animatablePropertiesJson.GetNamedObject("t", null);
                AnimatableFloatValue tracking = null;

                if (trackingJson != null)
                {
                    tracking = AnimatableFloatValue.Factory.NewInstance(trackingJson, composition);
                }

                return(new AnimatableTextProperties(color, stroke, strokeWidth, tracking));
            }