コード例 #1
0
    public void AnimateOpen(bool forward)
    {
        if (animating)
        {
            return;
        }

        animating = true;
        open      = forward;

        //bgBlurrer.enabled = true;
        _dimmer.enabled = true;
        if (forward)
        {
            setHighlighted(_backButton.rt);
        }
        this.varyWithT((rawT) =>
        {
            float t = forward ? rawT : 1 - rawT;

            _canvasGroup.alpha        = Mathf.InverseLerp(0, .75f, t);
            Color color               = Color.white;
            color.a                   = Mathf.InverseLerp(0, .75f, t);
            float elastT              = EasingFunctions.Calc(t, EasingFunctions.ExpoEaseOut);
            this.transform.localScale = Vector3.LerpUnclamped(Vector3.one * 3, Vector3.one, elastT);// EasingFunctions.Calc(t, EasingFunctions.QuadEaseOut));

            /*_rawImg.material.color = color;
             * _rawImg.material.SetFloat("_BlurAmt", Mathf.InverseLerp(1, 0.9f, t));
             * _rawImg.material.SetFloat("_MipsBias", 6*Mathf.InverseLerp(1, 0, t));
             * _rawImg.material.SetFloat("_BlurDist", 12 * (1-t));*/

            //bgBlurrer.blurAmount = t;
            _dimmer.color = Color.Lerp(_dimmerFullColor.withAlpha(0), _dimmerFullColor, t);

            _highlightImg.color = Color.white.withAlpha(Mathf.InverseLerp(.5f, 1, t));

            if (t == 1)
            {
                animating = false;
            }
        }, .5f);
    }
コード例 #2
0
    void animateChangedObject(int direction)
    {
        if (animating)
        {
            return;
        }

        animating = true;
        this.varyWithT((rawT) =>
        {
            float t = EasingFunctions.Calc(rawT, EasingFunctions.QuadEaseIn);
            if (prevThingToShow != null)
            {
                prevThingToShow.gameObject.GetComponent <RawImageFitter>().offset =
                    //new Vector2(direction * t * Screen.width, 0);
                    new Vector2(0, direction * t * Screen.height);
            }

            //thingToShow.alpha = 0;// Mathf.InverseLerp(.25f, 1, t);
            //thingToShow.transform.localScale = Vector3.Lerp(Vector3.zero, Vector3.one, thingToShow.alpha);//.withY(1);
            thingToShow.gameObject.GetComponent <RawImageFitter>().offset =
                //new Vector2(direction * (t - 1) * Screen.width, 0);
                new Vector2(0, direction * (t - 1) * Screen.height);

            if (t == 1)
            {
                animating = false;

                //this.varyWithT((j) => { thingToShow.alpha = j; }, .2f);
                if (prevThingToShow != null)
                {
                    prevThingToShow.alpha = 0;
                }
            }
        }, 0.25f);
    }