示例#1
0
        public MovinShapeSlave(MovinShape master, BodymovinShapePath path, float strokeWidth = 1f)
        {
            this.master = master;
            this.path   = path;
            Transform parent = master.transform.parent;


            /* SHAPE PROPS */

            points    = (BodyPoint[])path.points.Clone();
            motionSet = path.animSets;
            closed    = path.closed;


            /* ANIM SETUP */

            MotionSetup(ref animated, ref motion, motionSet);


            /* GAMEOBJECT */

            transform = new RectTransform();
            transform.SetParent(parent, false);
            transform.localPosition = master.transform.localPosition;


            /* SETUP VECTOR */

            fill = master.content.fillHidden || master.content.fillColor == null
                ? null
                : new SolidFill()
            {
                Color = master.fill.Color
            };
            stroke = master.content.strokeHidden || master.content.strokeColor == null
                ? null
                : new Stroke()
            {
                Color = master.stroke.Color, HalfThickness = master.content.strokeWidth * strokeWidth
            };
            props = new PathProperties()
            {
                Stroke = stroke
            };

            shape = new Shape()
            {
                Fill          = fill,
                PathProps     = props,
                FillTransform = Matrix3.I()
            };

            UpdateMesh();
        }
示例#2
0
        public MovinLayer(Movin movin, BodymovinLayer layer, int sort = 0)
        {
            this.movin = movin;
            content    = layer;
            this.sort  = sort;

            transform.SetParent(movin.transform, false);

            positionOffset = content.positionOffset;

            transform.localPosition = content.position + positionOffset;
            transform.localRotation = content.rotation;
            transform.localScale    = content.scale;

            finalRotation = content.rotationEuler;


            /* ANIM SETUP */

            MotionSetup(ref positionAnimated, ref mpos, content.positionSets);
            MotionSetup(ref anchorAnimated, ref manchor, content.anchorSets);
            MotionSetup(ref scaleAnimated, ref mscale, content.scaleSets);
            MotionSetup(ref rotationXAnimated, ref mrotx, content.rotationXSets);
            MotionSetup(ref rotationYAnimated, ref mroty, content.rotationYSets);
            MotionSetup(ref rotationZAnimated, ref mrotz, content.rotationZSets);
            MotionSetup(ref opacityAnimated, ref mopacity, content.opacitySets);

            currentAnchor  = content.anchorPoint;
            currentOpacity = content.opacity;


            /* SHAPES */

            shapes = new MovinShape[content.shapes.Length];

            int j = 0;

            for (int i = content.shapes.Length - 1; i >= 0; i--)
            {
                MovinShape shape = new MovinShape(this, content.shapes[i]);
                shape.UpdateOpacity(content.opacity);
                shapes[i] = shape;

                //shape.transform.localPosition += new Vector3(0, 0, -32 * j);
                j += 1;
            }
        }
示例#3
0
文件: Movin.cs 项目: UIWidgets/Movin
        /* ------ PUBLIC METHODS ------ */


        public void SetColor(Color c, bool fill = true, bool stroke = false)
        {
            for (int i = 0; i < layers.Length; i++)
            {
                for (int j = 0; j < layers[i].shapes.Length; j++)
                {
                    MovinShape s = layers[i].shapes[j];

                    if (fill)
                    {
                        s.UpdateFillColor(c);
                    }

                    if (stroke)
                    {
                        s.UpdateStrokeColor(c);
                    }
                }
            }
        }