internal static ShapeFill Parse(JsonReader reader, LottieComposition composition) { AnimatableColorValue color = null; bool fillEnabled = false; AnimatableIntegerValue opacity = null; string name = null; int fillTypeInt = 1; bool hidden = false; while (reader.HasNext()) { switch (reader.NextName()) { case "nm": name = reader.NextString(); break; case "c": color = AnimatableValueParser.ParseColor(reader, composition); break; case "o": opacity = AnimatableValueParser.ParseInteger(reader, composition); break; case "fillEnabled": fillEnabled = reader.NextBoolean(); break; case "r": fillTypeInt = reader.NextInt(); break; case "hd": hidden = reader.NextBoolean(); break; default: reader.SkipValue(); break; } } var fillType = fillTypeInt == 1 ? SKPathFillType.Winding : SKPathFillType.EvenOdd; return(new ShapeFill(name, fillEnabled, fillType, color, opacity, hidden)); }
private static AnimatableTextProperties ParseAnimatableTextProperties(JsonReader reader, LottieComposition composition) { AnimatableColorValue color = null; AnimatableColorValue stroke = null; AnimatableFloatValue strokeWidth = null; AnimatableFloatValue tracking = null; reader.BeginObject(); while (reader.HasNext()) { switch (reader.NextName()) { case "fc": color = AnimatableValueParser.ParseColor(reader, composition); break; case "sc": stroke = AnimatableValueParser.ParseColor(reader, composition); break; case "sw": strokeWidth = AnimatableValueParser.ParseFloat(reader, composition); break; case "t": tracking = AnimatableValueParser.ParseFloat(reader, composition); break; default: reader.SkipValue(); break; } } reader.EndObject(); return(new AnimatableTextProperties(color, stroke, strokeWidth, tracking)); }
internal static ShapeStroke Parse(JsonReader reader, LottieComposition composition) { string name = null; AnimatableColorValue color = null; AnimatableFloatValue width = null; AnimatableIntegerValue opacity = null; ShapeStroke.LineCapType capType = ShapeStroke.LineCapType.Unknown; ShapeStroke.LineJoinType joinType = ShapeStroke.LineJoinType.Round; AnimatableFloatValue offset = null; float miterLimit = 0f; List <AnimatableFloatValue> lineDashPattern = new List <AnimatableFloatValue>(); bool hidden = false; while (reader.HasNext()) { switch (reader.NextName()) { case "nm": name = reader.NextString(); break; case "c": color = AnimatableValueParser.ParseColor(reader, composition); break; case "w": width = AnimatableValueParser.ParseFloat(reader, composition); break; case "o": opacity = AnimatableValueParser.ParseInteger(reader, composition); break; case "lc": capType = (ShapeStroke.LineCapType)(reader.NextInt() - 1); break; case "lj": joinType = (ShapeStroke.LineJoinType)(reader.NextInt() - 1); break; case "ml": miterLimit = reader.NextDouble(); break; case "d": reader.BeginArray(); while (reader.HasNext()) { String n = null; AnimatableFloatValue val = null; reader.BeginObject(); while (reader.HasNext()) { switch (reader.NextName()) { case "n": n = reader.NextString(); break; case "v": val = AnimatableValueParser.ParseFloat(reader, composition); break; default: reader.SkipValue(); break; } } reader.EndObject(); switch (n) { case "o": offset = val; break; case "d": case "g": lineDashPattern.Add(val); break; } } reader.EndArray(); if (lineDashPattern.Count == 1) { // If there is only 1 value then it is assumed to be equal parts on and off. lineDashPattern.Add(lineDashPattern[0]); } break; case "hd": hidden = reader.NextBoolean(); break; default: reader.SkipValue(); break; } } return(new ShapeStroke(name, offset, lineDashPattern, color, opacity, width, capType, joinType, miterLimit, hidden)); }