Beispiel #1
0
        internal static ShapePath Parse(JsonReader reader, LottieComposition composition)
        {
            string name = null;
            var    ind  = 0;
            AnimatableShapeValue shape = null;

            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "nm":
                    name = reader.NextString();
                    break;

                case "ind":
                    ind = reader.NextInt();
                    break;

                case "ks":
                    shape = AnimatableValueParser.ParseShapeData(reader, composition);
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            return(new ShapePath(name, ind, shape));
        }
Beispiel #2
0
 public ShapePath(string name, int index, AnimatableShapeValue shapePath, bool hidden)
 {
     Name       = name;
     _index     = index;
     _shapePath = shapePath;
     IdHidden   = hidden;
 }
        internal static Mask Parse(JsonReader reader, LottieComposition composition)
        {
            var maskMode = Mask.MaskMode.MaskModeAdd;
            AnimatableShapeValue   maskPath = null;
            AnimatableIntegerValue opacity  = null;

            reader.BeginObject();
            while (reader.HasNext())
            {
                var mode = reader.NextName();
                switch (mode)
                {
                case "mode":
                    switch (reader.NextString())
                    {
                    case "a":
                        maskMode = Mask.MaskMode.MaskModeAdd;
                        break;

                    case "s":
                        maskMode = Mask.MaskMode.MaskModeSubtract;
                        break;

                    case "i":
                        composition.AddWarning(
                            "Animation contains intersect masks. They are not supported but will be treated like add masks.");
                        maskMode = Mask.MaskMode.MaskModeIntersect;
                        break;

                    default:
                        Debug.WriteLine($"Unknown mask mode {mode}. Defaulting to Add.", LottieLog.Tag);
                        maskMode = Mask.MaskMode.MaskModeAdd;
                        break;
                    }

                    break;

                case "pt":
                    maskPath = AnimatableValueParser.ParseShapeData(reader, composition);
                    break;

                case "o":
                    opacity = AnimatableValueParser.ParseInteger(reader, composition);
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            reader.EndObject();

            return(new Mask(maskMode, maskPath, opacity));
        }
Beispiel #4
0
 private Mask(MaskMode maskMode, AnimatableShapeValue maskPath, AnimatableIntegerValue opacity)
 {
     _maskMode = maskMode;
     MaskPath  = maskPath;
     Opacity   = opacity;
 }
Beispiel #5
0
 public ShapePath(string name, int index, AnimatableShapeValue shapePath)
 {
     _name      = name;
     _index     = index;
     _shapePath = shapePath;
 }