예제 #1
0
        private void PrepareAnimationObject(GameObject obj)
        {
            RectTransform trs   = obj.GetComponent <RectTransform>();
            Image         image = obj.GetComponent <Image>();

            Vector3Animator             scaleAnimator  = obj.GetComponent <Vector3Animator>();
            ColorAnimator               colorAnimator  = obj.GetComponent <ColorAnimator>();
            BezierMover                 mover          = obj.GetComponent <BezierMover>();
            RectTransformPositionObject positionObject = obj.GetComponent <RectTransformPositionObject>();

            Vector3AnimationData scaleData = new Vector3AnimationData()
            {
                AnimationMode = BosAnimationMode.Single,
                Duration      = interval * 0.5f,
                EaseType      = EaseType.EaseInOutQuad,
                EndValue      = Vector3.one * 1.25f,
                Events        = null,
                StartValue    = Vector3.one,
                Target        = obj,
                OnStart       = (s, o) => trs.localScale = s,
                OnUpdate      = (s, t, o) => trs.localScale = s,
                OnEnd         = (s, o) => {
                    trs.localScale = s;

                    Vector3AnimationData scale2Data = new Vector3AnimationData()
                    {
                        StartValue = Vector3.one * 1.25f,
                        EndValue   = Vector3.one,
                        Duration   = interval * 0.5f,
                        EaseType   = EaseType.EaseInOutQuad,
                        Target     = obj,
                        OnStart    = (s2, o2) => trs.localScale = s2,
                        OnUpdate   = (s2, t2, o2) => trs.localScale = s2,
                        OnEnd      = (s2, o2) => trs.localScale = s2
                    };
                    scaleAnimator.StartAnimation(scale2Data);

                    ColorAnimationData colorData = new ColorAnimationData()
                    {
                        StartValue = Color.white,
                        EndValue   = new Color(1, 1, 1, 0.2f),
                        Duration   = interval * 0.5f,
                        EaseType   = EaseType.EaseInOutQuad,
                        Target     = obj,
                        OnStart    = (c2, o2) => image.color = c2,
                        OnUpdate   = (c2, t2, o2) => image.color = c2,
                        OnEnd      = (c2, o2) => image.color = c2
                    };

                    colorAnimator.StartAnimation(colorData);
                }
            };

            scaleAnimator.StartAnimation(scaleData);

            var bezierData = AnimUtils.GetBizerQuadData(positionObject,
                                                        startObject.anchoredPosition,
                                                        endObject.anchoredPosition,
                                                        interval * 1.1f, (go) => Destroy(go),
                                                        linerFactor,
                                                        orthoFactor);

            mover.Setup(bezierData);
        }