Beispiel #1
0
        public void BackOut()
        {
            Assert.AreEqual(
                0f,
                Easing.BackOut(0f)
                );

            Assert.AreEqual(
                1f,
                Easing.BackOut(1f)
                );

            Assert.AreEqual(
                1.08769751f,
                Easing.BackOut(0.5f)
                );
        }
    public IEnumerator MoveAnimation(float seconds)
    {
        //!< 時間計測開始
        float startTime = Time.time;
        float scalX     = this.transform.localScale.x;
        float scalY     = this.transform.localScale.y;

        while (seconds > Time.time - startTime)
        {
            // QuadIn
            float h = Easing.BackOut(Time.time - startTime, seconds, 0.0f, scalY, 1.0f);
            this.transform.localScale = new Vector3(scalX, h, 0);
            // 継続
            yield return(null);
        }
        // 調整用
        this.transform.localScale = new Vector3(scalX, scalY, 0);
    }
Beispiel #3
0
    public IEnumerator StartEventing()
    {
        //!< 時間計測開始
        float        seconds      = 1.0f;
        ProcessTimer processTimer = new ProcessTimer();
        //!< 色情報取得
        Image image = this.GetComponent <Image>();
        Color col   = image.color;

        //=====================================================
        // 右から登場+縦サイズ変更+α値↑
        //=====================================================
        seconds = 0.6f;
        processTimer.Restart();
        while (seconds > processTimer.TotalSeconds)
        {
            // QuadIn
            float x = Easing.BackOut(processTimer.TotalSeconds, seconds, 500.0f, 0.0f, 1.0f);
            float h = Easing.QuartOut(processTimer.TotalSeconds, seconds, 0.3f, 1.0f);
            float a = Easing.QuartOut(processTimer.TotalSeconds, seconds, 0.2f, 1.0f);

            this.transform.localPosition = new Vector3(x, 0, 0);
            this.transform.localScale    = new Vector3(1.0f, h, 1.0f);
            image.color = new Color(col.r, col.g, col.b, a);
            // 継続
            yield return(null);
        }
        // 調整用
        this.transform.localPosition = new Vector3(0, 0, 0);
        this.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);
        image.color = new Color(col.r, col.g, col.b, 1.0f);

        //=====================================================
        // 待機
        //=====================================================
        yield return(new WaitForSecondsRealtime(0.1f));

        //=====================================================
        // サイズ縮小+α値↓
        //=====================================================
        seconds = 0.35f;
        processTimer.Restart();
        while (seconds > processTimer.TotalSeconds)
        {
            // QuadIn
            float wh = Easing.CubicOut(processTimer.TotalSeconds, seconds, 1.0f, 0.6f);
            float a  = Easing.SineIn(processTimer.TotalSeconds, seconds, 1.0f, 0.5f);

            this.transform.localScale = new Vector3(wh, wh, 1.0f);
            image.color = new Color(col.r, col.g, col.b, a);

            // 継続
            yield return(null);
        }
        // 調整用
        this.transform.localScale = new Vector3(0.6f, 0.6f, 1.0f);
        image.color = new Color(col.r, col.g, col.b, 0.5f);

        //=====================================================
        // サイズ拡大+α値↓
        //=====================================================
        seconds = 0.45f;
        processTimer.Restart();
        while (seconds > processTimer.TotalSeconds)
        {
            // QuadIn
            float wh = Easing.CubicOut(processTimer.TotalSeconds, seconds, 0.6f, 1.6f);
            float a  = Easing.SineIn(processTimer.TotalSeconds, seconds, 0.5f, 0.0f);

            this.transform.localScale = new Vector3(wh, wh, 1.0f);
            image.color = new Color(col.r, col.g, col.b, a);

            if (!isStart)
            {
                if (wh >= 1.0f)
                {
                    // 本編動き出す
                    StageManager.Instance.SetFlg(StageFlg.NOMAL);
                    isStart = true;
                }
            }

            // 継続
            yield return(null);
        }
        // 調整用
        //this.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
        //image.color = new Color(col.r, col.g, col.b, 0.0f);

        //Destroy(this.gameObject);
    }
Beispiel #4
0
    private void Move()
    {
        float xx = (endX - startX) * time / easingTime;
        float yy = 0.0f;

        switch (type)
        {
        case EasingType.Constant:
            yy = endY;
            break;

        case EasingType.QuadIn:
            yy = Easing.QuadIn(time, easingTime, startY, endY);
            break;

        case EasingType.QuadOut:
            yy = Easing.QuadOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuadInOut:
            yy = Easing.QuadInOut(time, easingTime, startY, endY);
            break;

        case EasingType.CubicIn:
            yy = Easing.CubicIn(time, easingTime, startY, endY);
            break;

        case EasingType.CubicOut:
            yy = Easing.CubicOut(time, easingTime, startY, endY);
            break;

        case EasingType.CubicInOut:
            yy = Easing.CubicInOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuartIn:
            yy = Easing.QuartIn(time, easingTime, startY, endY);
            break;

        case EasingType.QuartOut:
            yy = Easing.QuartOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuartInOut:
            yy = Easing.QuartInOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuintIn:
            yy = Easing.QuintIn(time, easingTime, startY, endY);
            break;

        case EasingType.QuintOut:
            yy = Easing.QuintOut(time, easingTime, startY, endY);
            break;

        case EasingType.QuintInOut:
            yy = Easing.QuintInOut(time, easingTime, startY, endY);
            break;

        case EasingType.SineIn:
            yy = Easing.SineIn(time, easingTime, startY, endY);
            break;

        case EasingType.SineOut:
            yy = Easing.SineOut(time, easingTime, startY, endY);
            break;

        case EasingType.SineInOut:
            yy = Easing.SineInOut(time, easingTime, startY, endY);
            break;

        case EasingType.ExpIn:
            yy = Easing.ExpIn(time, easingTime, startY, endY);
            break;

        case EasingType.ExpOut:
            yy = Easing.ExpOut(time, easingTime, startY, endY);
            break;

        case EasingType.ExpInOut:
            yy = Easing.ExpInOut(time, easingTime, startY, endY);
            break;

        case EasingType.CircIn:
            yy = Easing.CircIn(time, easingTime, startY, endY);
            break;

        case EasingType.CircOut:
            yy = Easing.CircOut(time, easingTime, startY, endY);
            break;

        case EasingType.CircInOut:
            yy = Easing.CircInOut(time, easingTime, startY, endY);
            break;

        case EasingType.ElasticIn:
            yy = Easing.ElasticIn(time, easingTime, startY, endY);
            break;

        case EasingType.ElasticOut:
            yy = Easing.ElasticOut(time, easingTime, startY, endY);
            break;

        case EasingType.ElasticInOut:
            yy = Easing.ElasticInOut(time, easingTime, startY, endY);
            break;

        case EasingType.BackIn:
            yy = Easing.BackIn(time, easingTime, startY, endY, 1.7f);
            break;

        case EasingType.BackOut:
            yy = Easing.BackOut(time, easingTime, startY, endY, 1.7f);
            break;

        case EasingType.BackInOut:
            yy = Easing.BackInOut(time, easingTime, startY, endY, 1.7f);
            break;

        case EasingType.BounceIn:
            yy = Easing.BounceIn(time, easingTime, startY, endY);
            break;

        case EasingType.BounceOut:
            yy = Easing.BounceOut(time, easingTime, startY, endY);
            break;

        case EasingType.BounceInOut:
            yy = Easing.BounceInOut(time, easingTime, startY, endY);
            break;

        case EasingType.Linear:
            yy = Easing.Linear(time, easingTime, startY, endY);
            break;
        }

        if (float.IsNaN(yy))
        {
            yy = 1;
        }

        ball.transform.position = new Vector3(startX + xx, yy, 0);
    }
Beispiel #5
0
 public System.Func <float, float> GetEaseAction(EzEaseType type)
 {
     if (type == EzEaseType.SineIn)
     {
         return((v) => Easing.SineIn(v));
     }
     else if (type == EzEaseType.SineOut)
     {
         return((v) => Easing.SineOut(v));
     }
     else if (type == EzEaseType.SineInOut)
     {
         return((v) => Easing.SineInOut(v));
     }
     else if (type == EzEaseType.QuadIn)
     {
         return((v) => Easing.QuadIn(v));
     }
     else if (type == EzEaseType.QuadOut)
     {
         return((v) => Easing.QuadOut(v));
     }
     else if (type == EzEaseType.QuadInOut)
     {
         return((v) => Easing.QuadInOut(v));
     }
     else if (type == EzEaseType.CubicIn)
     {
         return((v) => Easing.CubicIn(v));
     }
     else if (type == EzEaseType.CubicOut)
     {
         return((v) => Easing.CubicOut(v));
     }
     else if (type == EzEaseType.CubicInOut)
     {
         return((v) => Easing.CubicInOut(v));
     }
     else if (type == EzEaseType.QuartIn)
     {
         return((v) => Easing.QuartIn(v));
     }
     else if (type == EzEaseType.QuartOut)
     {
         return((v) => Easing.QuartOut(v));
     }
     else if (type == EzEaseType.QuartInOut)
     {
         return((v) => Easing.QuartInOut(v));
     }
     else if (type == EzEaseType.ExpIn)
     {
         return((v) => Easing.ExpIn(v));
     }
     else if (type == EzEaseType.ExpOut)
     {
         return((v) => Easing.ExpOut(v));
     }
     else if (type == EzEaseType.ExpInOut)
     {
         return((v) => Easing.ExpInOut(v));
     }
     else if (type == EzEaseType.CircIn)
     {
         return((v) => Easing.CircIn(v));
     }
     else if (type == EzEaseType.CircOut)
     {
         return((v) => Easing.CircOut(v));
     }
     else if (type == EzEaseType.CircInOut)
     {
         return((v) => Easing.CircInOut(v));
     }
     else if (type == EzEaseType.ElasticIn)
     {
         return((v) => Easing.ElasticIn(v));
     }
     else if (type == EzEaseType.ElasticOut)
     {
         return((v) => Easing.ElasticOut(v));
     }
     else if (type == EzEaseType.ElasticInOut)
     {
         return((v) => Easing.ElasticInOut(v));
     }
     else if (type == EzEaseType.BackIn)
     {
         return((v) => Easing.BackIn(v));
     }
     else if (type == EzEaseType.BackOut)
     {
         return((v) => Easing.BackOut(v));
     }
     else if (type == EzEaseType.BackInOut)
     {
         return((v) => Easing.BackInOut(v));
     }
     else if (type == EzEaseType.BounceIn)
     {
         return((v) => Easing.BounceIn(v));
     }
     else if (type == EzEaseType.BounceOut)
     {
         return((v) => Easing.BounceOut(v));
     }
     else if (type == EzEaseType.BounceInOut)
     {
         return((v) => Easing.BounceInOut(v));
     }
     else
     {
         return((v) => Easing.Linear(v));
     }
 }