Exemple #1
0
        protected override void OnUpdateValue()
        {
            if (m_UpdateValue == null)
            {
                StopTween(false);
                return;
            }

            m_UpdateValue(BaseTween.Estimate(m_TweenType, m_StartValue, m_TargetValue, m_DeltaTime, m_Duration,
                                             m_CustomCurve));
        }
Exemple #2
0
        protected override void OnUpdateValue()
        {
            if (m_UpdateValue == null)
            {
                StopTween(false);
                return;
            }

            Vector2 value = new Vector2
            {
                x = BaseTween.Estimate(m_TweenType, m_StartValue.x, m_TargetValue.x, m_DeltaTime, m_Duration, m_CustomCurve),
                y = BaseTween.Estimate(m_TweenType, m_StartValue.y, m_TargetValue.y, m_DeltaTime, m_Duration, m_CustomCurve)
            };

            m_UpdateValue(value);
        }
Exemple #3
0
        protected override void OnUpdateValue()
        {
            if (m_UpdateValue == null)
            {
                StopTween(false);
                return;
            }

            Color value = new Color
            {
                r = BaseTween.Estimate(m_TweenType, m_StartValue.r, m_TargetValue.r, m_DeltaTime, m_Duration, m_CustomCurve),
                g = BaseTween.Estimate(m_TweenType, m_StartValue.g, m_TargetValue.g, m_DeltaTime, m_Duration, m_CustomCurve),
                b = BaseTween.Estimate(m_TweenType, m_StartValue.b, m_TargetValue.b, m_DeltaTime, m_Duration, m_CustomCurve),
                a = BaseTween.Estimate(m_TweenType, m_StartValue.a, m_TargetValue.a, m_DeltaTime, m_Duration, m_CustomCurve)
            };

            m_UpdateValue(value);
        }
Exemple #4
0
        private void SetupCurves()
        {
            m_AnimationCurves = new AnimationCurve[ValueLength()];
            m_Keyframes       = new Keyframe[ValueLength()][];

            if (m_TweenType == TweenType.Custom)
            {
                for (int i = 0; i < ValueLength(); i++)
                {
                    m_Keyframes[i] = m_CustomCurve.keys;
                }
            }
            else
            {
                GetKeys(BaseTween.GetAnimCurveKeys(m_TweenType));
            }

            for (int i = 0; i < ValueLength(); i++)
            {
                for (int j = 0; j < m_Keyframes[i].Length; j++)
                {
                    m_Keyframes[i][j].value *= GetValue(true, i) - GetValue(false, i);
                    m_Keyframes[i][j].value += GetValue(false, i);
                    m_Keyframes[i][j].time  *= m_Duration;
                }

                m_AnimationCurves[i] = new AnimationCurve(m_Keyframes[i]);

                if (m_CustomCurve == null)
                {
                    for (int j = 0; j < m_Keyframes[i].Length; j++)
                    {
                        m_AnimationCurves[i].SmoothTangents(j, 0f);
                    }
                }
            }
        }