private AnimatableTransform(AnimatablePathValue anchorPoint, IAnimatableValue <PointF> position, AnimatableScaleValue scale, AnimatableFloatValue rotation, AnimatableIntegerValue opacity)
 {
     AnchorPoint = anchorPoint;
     Position    = position;
     Scale       = scale;
     Rotation    = rotation;
     Opacity     = opacity;
 }
            internal static AnimatableTransform NewInstance()
            {
                var anchorPoint = new AnimatablePathValue();
                IAnimatableValue <PointF> position = new AnimatablePathValue();
                var scale    = AnimatableScaleValue.Factory.NewInstance();
                var rotation = AnimatableFloatValue.Factory.NewInstance();
                var opacity  = AnimatableIntegerValue.Factory.NewInstance();

                return(new AnimatableTransform(anchorPoint, position, scale, rotation, opacity));
            }
Пример #3
0
 private AnimatableTransform(AnimatablePathValue anchorPoint, IAnimatableValue <Vector2?> position, AnimatableScaleValue scale, AnimatableFloatValue rotation, AnimatableIntegerValue opacity, AnimatableFloatValue startOpacity, AnimatableFloatValue endOpacity)
 {
     AnchorPoint  = anchorPoint;
     Position     = position;
     Scale        = scale;
     Rotation     = rotation;
     Opacity      = opacity;
     StartOpacity = startOpacity;
     EndOpacity   = endOpacity;
 }
Пример #4
0
            internal static PolystarShape NewInstance(JsonObject json, LottieComposition composition)
            {
                var name             = json.GetNamedString("nm");
                var type             = (Type)(int)json.GetNamedNumber("sy");
                var points           = AnimatableFloatValue.Factory.NewInstance(json.GetNamedObject("pt"), composition, false);
                var position         = AnimatablePathValue.CreateAnimatablePathOrSplitDimensionPath(json.GetNamedObject("p"), composition);
                var rotation         = AnimatableFloatValue.Factory.NewInstance(json.GetNamedObject("r"), composition, false);
                var outerRadius      = AnimatableFloatValue.Factory.NewInstance(json.GetNamedObject("or"), composition);
                var outerRoundedness = AnimatableFloatValue.Factory.NewInstance(json.GetNamedObject("os"), composition, false);
                AnimatableFloatValue innerRadius;
                AnimatableFloatValue innerRoundedness;

                if (type == Type.Star)
                {
                    innerRadius      = AnimatableFloatValue.Factory.NewInstance(json.GetNamedObject("ir"), composition);
                    innerRoundedness = AnimatableFloatValue.Factory.NewInstance(json.GetNamedObject("is"), composition, false);
                }
                else
                {
                    innerRadius      = null;
                    innerRoundedness = null;
                }
                return(new PolystarShape(name, type, points, position, rotation, innerRadius, outerRadius, innerRoundedness, outerRoundedness));
            }
            internal static AnimatableTransform NewInstance(JsonObject json, LottieComposition composition)
            {
                AnimatablePathValue       anchorPoint;
                IAnimatableValue <PointF> position = null;
                AnimatableScaleValue      scale;
                AnimatableFloatValue      rotation = null;
                AnimatableIntegerValue    opacity;
                var anchorJson = json.GetNamedObject("a", null);

                if (anchorJson != null)
                {
                    anchorPoint = new AnimatablePathValue(anchorJson["k"], composition);
                }
                else
                {
                    // Cameras don't have an anchor point property. Although we don't support them, at least
                    // we won't crash.
                    Debug.WriteLine("Layer has no transform property. You may be using an unsupported " + "layer type such as a camera.", "LOTTIE");
                    anchorPoint = new AnimatablePathValue();
                }

                var positionJson = json.GetNamedObject("p", null);

                if (positionJson != null)
                {
                    position = AnimatablePathValue.CreateAnimatablePathOrSplitDimensionPath(positionJson, composition);
                }
                else
                {
                    ThrowMissingTransform("position");
                }

                var scaleJson = json.GetNamedObject("s", null);

                if (scaleJson != null)
                {
                    scale = AnimatableScaleValue.Factory.NewInstance(scaleJson, composition);
                }
                else
                {
                    // Somehow some community animations don't have scale in the transform.
                    scale = new AnimatableScaleValue(new List <IKeyframe <ScaleXy> >(), new ScaleXy());
                }

                var rotationJson = json.GetNamedObject("r", null);

                if (rotationJson == null)
                {
                    rotationJson = json.GetNamedObject("rz", null);
                }
                if (rotationJson != null)
                {
                    rotation = AnimatableFloatValue.Factory.NewInstance(rotationJson, composition, false);
                }
                else
                {
                    ThrowMissingTransform("rotation");
                }

                var opacityJson = json.GetNamedObject("o", null);

                if (opacityJson != null)
                {
                    opacity = AnimatableIntegerValue.Factory.NewInstance(opacityJson, composition);
                }
                else
                {
                    // Somehow some community animations don't have opacity in the transform.
                    opacity = new AnimatableIntegerValue(new List <IKeyframe <int?> >(), 100);
                }
                return(new AnimatableTransform(anchorPoint, position, scale, rotation, opacity));
            }
Пример #6
0
 internal static CircleShape NewInstance(JsonObject json, LottieComposition composition)
 {
     return(new CircleShape(json.GetNamedString("nm"), AnimatablePathValue.CreateAnimatablePathOrSplitDimensionPath(json.GetNamedObject("p"), composition), AnimatablePointValue.Factory.NewInstance(json.GetNamedObject("s"), composition)));
 }