示例#1
0
    public float GetNextValue(float currentValue)
    {
        if (this.time <= 0)
        {
            return(currentValue);
        }

        float total   = this.time;
        float current = Time.time - this.startTime;
        float percent = current / total;

        if (percent < 1 && percent >= 0)
        {
            float easePercent = Easings.BackEaseInOut(percent);
            float step        = easePercent * (this.next - this.previous);

            return(previous + step);
        }

        this.startTime = Time.time;
        this.previous  = this.next;
        this.next      = Random.Range(this.start - this.amplitude, this.start + this.amplitude);

        return(this.GetNextValue(currentValue));
    }
示例#2
0
        public IEnumerator _SizeUp()
        {
            BallValue++;
            var scaleValue = ScaleValue;

            _rigidBody.mass = 1 + scaleValue * 15;
            _meshRenderer.material.color = Color.Lerp(Color.blue, Color.red, BallValue / 10f);
            _text.text = BallText;

            var alpha      = 0f;
            var startScale = transform.localScale;
            var endScale   = new Vector3(scaleValue, scaleValue, scaleValue);

            print($"startScale: {startScale} ;; endScale: {endScale}");
            while (alpha <= 1)
            {
                var _val = Easings.BackEaseInOut(alpha);
                /// print("_val"+_val);
                transform.localScale = new Vector3(Mathf.Lerp(startScale.x, endScale.x, _value), Mathf.Lerp(startScale.y, endScale.y, _value), Mathf.Lerp(startScale.z, endScale.z, _value));
                ///print("x: "+transform.localScale.x);
                transform.GetChild(0).localEulerAngles = new Vector3(0, Mathf.Lerp(0, 360, alpha), 0);
                alpha += Time.deltaTime * updateSizeSpeed;
                yield return(null);
            }

            transform.localScale = new Vector3(Mathf.Lerp(startScale.x, endScale.x, 1), Mathf.Lerp(startScale.y, endScale.y, 1), Mathf.Lerp(startScale.z, endScale.z, 1));
            print("Final x: " + transform.localScale.x);
            //transform.localScale = Vector3.Lerp(startScale,endScale,1);
            transform.GetChild(0).localEulerAngles = new Vector3(0, Mathf.Lerp(0, 360, alpha), 0);
            _sizeUpRoutine = null;
        }
示例#3
0
    // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
    public static float Interpolate(float p, Easings.Functions function)
    {
        switch (function)
        {
        default:
            return(Easings.Linear(p));

        case Easings.Functions.QuadraticEaseIn:
            return(Easings.QuadraticEaseIn(p));

        case Easings.Functions.QuadraticEaseOut:
            return(Easings.QuadraticEaseOut(p));

        case Easings.Functions.QuadraticEaseInOut:
            return(Easings.QuadraticEaseInOut(p));

        case Easings.Functions.CubicEaseIn:
            return(Easings.CubicEaseIn(p));

        case Easings.Functions.CubicEaseOut:
            return(Easings.CubicEaseOut(p));

        case Easings.Functions.CubicEaseInOut:
            return(Easings.CubicEaseInOut(p));

        case Easings.Functions.QuarticEaseIn:
            return(Easings.QuarticEaseIn(p));

        case Easings.Functions.QuarticEaseOut:
            return(Easings.QuarticEaseOut(p));

        case Easings.Functions.QuarticEaseInOut:
            return(Easings.QuarticEaseInOut(p));

        case Easings.Functions.QuinticEaseIn:
            return(Easings.QuinticEaseIn(p));

        case Easings.Functions.QuinticEaseOut:
            return(Easings.QuinticEaseOut(p));

        case Easings.Functions.QuinticEaseInOut:
            return(Easings.QuinticEaseInOut(p));

        case Easings.Functions.SineEaseIn:
            return(Easings.SineEaseIn(p));

        case Easings.Functions.SineEaseOut:
            return(Easings.SineEaseOut(p));

        case Easings.Functions.SineEaseInOut:
            return(Easings.SineEaseInOut(p));

        case Easings.Functions.CircularEaseIn:
            return(Easings.CircularEaseIn(p));

        case Easings.Functions.CircularEaseOut:
            return(Easings.CircularEaseOut(p));

        case Easings.Functions.CircularEaseInOut:
            return(Easings.CircularEaseInOut(p));

        case Easings.Functions.ExponentialEaseIn:
            return(Easings.ExponentialEaseIn(p));

        case Easings.Functions.ExponentialEaseOut:
            return(Easings.ExponentialEaseOut(p));

        case Easings.Functions.ExponentialEaseInOut:
            return(Easings.ExponentialEaseInOut(p));

        case Easings.Functions.ElasticEaseIn:
            return(Easings.ElasticEaseIn(p));

        case Easings.Functions.ElasticEaseOut:
            return(Easings.ElasticEaseOut(p));

        case Easings.Functions.ElasticEaseInOut:
            return(Easings.ElasticEaseInOut(p));

        case Easings.Functions.BackEaseIn:
            return(Easings.BackEaseIn(p));

        case Easings.Functions.BackEaseOut:
            return(Easings.BackEaseOut(p));

        case Easings.Functions.BackEaseInOut:
            return(Easings.BackEaseInOut(p));

        case Easings.Functions.BounceEaseIn:
            return(Easings.BounceEaseIn(p));

        case Easings.Functions.BounceEaseOut:
            return(Easings.BounceEaseOut(p));

        case Easings.Functions.BounceEaseInOut:
            return(Easings.BounceEaseInOut(p));
        }
    }