Exemple #1
0
            internal static AnimatableTextFrame NewInstance(JsonObject json, LottieComposition composition)
            {
                if (json != null && json.ContainsKey("x"))
                {
                    composition.AddWarning("Lottie doesn't support expressions.");
                }
                var 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 != null && 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 AnimatableColorValue NewInstance(JsonObject json, LottieComposition composition)
            {
                var result = AnimatableValueParser <Color> .NewInstance(json, 1f, composition, ColorFactory.Instance).ParseJson();

                return(new AnimatableColorValue(result.Keyframes, result.InitialValue));
            }
Exemple #5
0
            internal static AnimatablePointValue NewInstance(JsonObject json, LottieComposition composition)
            {
                var result = AnimatableValueParser <Vector2?> .NewInstance(json, composition.DpScale, composition, PointFFactory.Instance).ParseJson();

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