internal static AnimatableGradientColorValue NewInstance(JsonObject json, LottieComposition composition)
            {
                var result = AnimatableValueParser <GradientColor> .NewInstance(json, 1, composition, new ValueFactory((int)json.GetNamedNumber("p"))).ParseJson();

                var initialValue = result.InitialValue;

                return(new AnimatableGradientColorValue(result.Keyframes, initialValue));
            }
            internal static AnimatableTextFrame NewInstance(JsonObject json, LottieComposition composition)
            {
                if (json != null && json.ContainsKey("x"))
                {
                    composition.AddWarning("Lottie doesn't support expressions.");
                }
                AnimatableValueParser <DocumentData> .Result result = AnimatableValueParser <DocumentData> .NewInstance(json, 1, composition, ValueFactory.Instance).ParseJson();

                return(new AnimatableTextFrame(result.Keyframes, result.InitialValue));
            }
            internal static AnimatableGradientColorValue NewInstance(JsonObject json, LottieComposition composition)
            {
                var kLength = (json.GetNamedArray("k", null)?.Count ?? 0) / 4;
                var points  = (int)json.GetNamedNumber("p", kLength);
                var result  = AnimatableValueParser <GradientColor> .NewInstance(json, 1, composition, new ValueFactory(points)).ParseJson();

                var initialValue = result.InitialValue;

                return(new AnimatableGradientColorValue(result.Keyframes, initialValue));
            }
            internal static AnimatableFloatValue NewInstance(JsonObject json, LottieComposition composition, bool isDp = true)
            {
                var scale = isDp ? composition.DpScale : 1f;

                if (json.ContainsKey("x"))
                {
                    composition.AddWarning("Lottie doesn't support expressions.");
                }
                var result = AnimatableValueParser <float?> .NewInstance(json, scale, composition, ValueFactory.Instance).ParseJson();

                return(new AnimatableFloatValue(result.Keyframes, result.InitialValue));
            }
            internal static AnimatableIntegerValue NewInstance(JsonObject json, LottieComposition composition)
            {
                if (json != null && json.ContainsKey("x"))
                {
                    composition.AddWarning("Lottie doesn't support expressions.");
                }
                var result = AnimatableValueParser <int?> .NewInstance(json, 1, composition, ValueFactory.Instance).ParseJson();

                var initialValue = result.InitialValue;

                return(new AnimatableIntegerValue(result.Keyframes, initialValue));
            }
Example #6
0
            internal static AnimatableColorValue NewInstance(JsonObject json, LottieComposition composition)
            {
                var result = AnimatableValueParser <Color> .NewInstance(json, 1f, composition, ColorFactory.Instance).ParseJson();

                return(new AnimatableColorValue(result.Keyframes, result.InitialValue));
            }
Example #7
0
            internal static AnimatableShapeValue NewInstance(JsonObject json, LottieComposition composition)
            {
                var result = AnimatableValueParser <ShapeData> .NewInstance(json, composition.DpScale, composition, ShapeData.Factory.Instance).ParseJson();

                return(new AnimatableShapeValue(result.Keyframes, result.InitialValue));
            }