private void ScaleTitle()
        {
            var data1 = AnimUtils.GetScaleAnimData(1, 1.1f, 0.4f, EaseType.EaseInOutSin, titleObject.GetComponent <RectTransform>(), () => {
                var data2 = AnimUtils.GetScaleAnimData(1.1f, 1, 0.4f, EaseType.EaseInOutSin, titleObject.GetComponent <RectTransform>());
                titleObject.GetOrAdd <Vector2Animator>().StartAnimation(data2);
            });

            titleObject.GetOrAdd <Vector2Animator>().StartAnimation(data1);
        }
Example #2
0
        private IEnumerator StartAnimationImpl(List <FloatAnimationData> datas)
        {
            if (isWaitingForStart)
            {
                yield break;
            }
            if (IsStarted)
            {
                isWaitingForStart = true;
            }
            yield return(new WaitUntil(() => false == IsStarted));

            isWaitingForStart = false;

            if (!IsStarted)
            {
                Datas.Clear();
                foreach (var data in datas)
                {
                    Datas.Add(new BosFloatAnimationInfo {
                        Data      = data,
                        Direction = BosAnimationDirection.Forward
                    });
                }
                timer = 0f;
                easeFuncs.Clear();
                events.Clear();

                for (int i = 0; i < Datas.Count; i++)
                {
                    easeFuncs.Add(AnimUtils.GetEaseFunc(Datas[i].Data.EaseType));
                    List <AnimationEventInfo <float> > dataEvents = new List <AnimationEventInfo <float> >();
                    if (Datas[i].Data.Events != null)
                    {
                        foreach (AnimationEvent <float> evt in Datas[i].Data.Events)
                        {
                            dataEvents.Add(new AnimationEventInfo <float> {
                                Event       = evt,
                                IsCompleted = false
                            });
                        }
                    }
                    events.Add(dataEvents);
                }
                isStartedStatus.Clear();
                for (int i = 0; i < Datas.Count; i++)
                {
                    isStartedStatus.Add(true);
                }
                Datas.ForEach(d => d.Data.OnStart?.Invoke(d.Data.StartValue, d.Data.Target));
            }
        }