internal static PathKeyframe Parse(JsonReader reader, LottieComposition composition) { bool animated = reader.Peek() == JsonToken.StartObject; Keyframe <Vector2?> keyframe = KeyframeParser.Parse(reader, composition, Utils.Utils.DpScale(), PathParser.Instance, animated); return(new PathKeyframe(composition, keyframe)); }
internal static List <Keyframe <T> > Parse <T>(JsonReader reader, LottieComposition composition, float scale, IValueParser <T> valueParser) { var keyframes = new List <Keyframe <T> >(); if (reader.Peek() == JsonToken.String) { composition.AddWarning("Lottie doesn't support expressions."); return(keyframes); } reader.BeginObject(); while (reader.HasNext()) { switch (reader.NextName()) { case "k": if (reader.Peek() == JsonToken.StartArray) { reader.BeginArray(); if (reader.Peek() == JsonToken.Integer || reader.Peek() == JsonToken.Float) { // For properties in which the static value is an array of numbers. keyframes.Add(KeyframeParser.Parse(reader, composition, scale, valueParser, false)); } else { while (reader.HasNext()) { keyframes.Add(KeyframeParser.Parse(reader, composition, scale, valueParser, true)); } } reader.EndArray(); } else { keyframes.Add(KeyframeParser.Parse(reader, composition, scale, valueParser, false)); } break; default: reader.SkipValue(); break; } } reader.EndObject(); SetEndFrames <Keyframe <T>, T>(keyframes); return(keyframes); }