Ejemplo n.º 1
0
        public static AnimatablePathValue Parse(JsonReader reader, LottieComposition composition)
        {
            List <Keyframe <Vector2?> > keyframes = new List <Keyframe <Vector2?> >();

            if (reader.Peek() == JsonToken.StartArray)
            {
                reader.BeginArray();
                while (reader.HasNext())
                {
                    keyframes.Add(PathKeyframeParser.Parse(reader, composition));
                }
                reader.EndArray();
                KeyframesParser.SetEndFrames <Keyframe <Vector2?>, Vector2?>(keyframes);
            }
            else
            {
                keyframes.Add(new Keyframe <Vector2?>(JsonUtils.JsonToPoint(reader, Utils.Utils.DpScale())));
            }
            return(new AnimatablePathValue(keyframes));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Will return null if the animation can't be played such as if it has expressions.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="reader"></param>
 /// <param name="scale"></param>
 /// <param name="composition"></param>
 /// <param name="valueParser"></param>
 /// <returns></returns>
 private static List <Keyframe <T> > Parse <T>(JsonReader reader, float scale, LottieComposition composition, IValueParser <T> valueParser)
 {
     return(KeyframesParser.Parse(reader, composition, scale, valueParser));
 }