Esempio n. 1
0
    void Squeeze(float t, Vector3 pivotScale)
    {
        float sx = PennerAnimation.CubicEaseInOut(t, pivotScale.x * 1 - changeInValue, pivotScale.x * changeInValue, 1);
        float sy = PennerAnimation.CubicEaseInOut(1 - t, pivotScale.y * 1 - changeInValue, pivotScale.y * changeInValue, 1);

        transform.localScale = new Vector3(sx, sy, pivotScale.z);
    }
Esempio n. 2
0
    void Rock(float t, Quaternion pivotRotation)
    {
        Vector3 angles = pivotRotation.eulerAngles;
        float   z      = PennerAnimation.CubicEaseInOut(t, 0, 1, 1);

        angles.z = (z - 0.5f) * changeInValue;

        transform.localRotation = Quaternion.Euler(angles);
    }
Esempio n. 3
0
    override public IEnumerator Press()
    {
        float elapsedTime = 0;

        while (currentState == state.Press && elapsedTime < animationTime)
        {
            float s = PennerAnimation.CubicEaseInOut(elapsedTime, 1f, scaleFactor, animationTime);
            transform.localScale = pivotScale * s;
            elapsedTime         += Time.unscaledDeltaTime;
            yield return(0);
        }
        transform.localScale = pivotScale * (1 + scaleFactor);
        while (currentState == state.Press)
        {
            yield return(0);
        }
    }
Esempio n. 4
0
    override public IEnumerator Release()
    {
        float elapsedTime = 0;
        float initScale   = 1 + scaleFactor;

        while (currentState == state.Release && elapsedTime < animationTime)
        {
            float s = PennerAnimation.CubicEaseInOut(elapsedTime, initScale, -scaleFactor, animationTime);
            transform.localScale = pivotScale * s;
            elapsedTime         += Time.unscaledDeltaTime;
            yield return(0);
        }
        transform.localScale = pivotScale;
        if (currentState == state.Release)
        {
            ChangeState(state.Idle);
        }
    }
    override public IEnumerator Press()
    {
        float elapsedTime = 0;
        float initScale   = 1.0f;
        float targetScale = 0.9f;

        while (currentState == state.Press && elapsedTime < animationTime)
        {
            float s = PennerAnimation.CubicEaseInOut(elapsedTime, initScale, targetScale - initScale, animationTime);
            transform.localScale = pivotScale * s * scaleFactor;
            elapsedTime         += Time.unscaledDeltaTime;
            yield return(0);
        }
        transform.localScale = pivotScale * targetScale * scaleFactor;
        while (currentState == state.Press)
        {
            yield return(0);
        }
    }