SmoothStep() public static method

public static SmoothStep ( float x, float min, float max ) : float
x float
min float
max float
return float
コード例 #1
0
    private IEnumerator MoveUp()
    {
        Vector3 originalPostion = new Vector3(0, -250, 1);
        Vector3 targetPostion   = new Vector3(0, 250, 1);

        float time = 0;

        while (time < 2.5f)
        {
            transform.localPosition = Vector3.Lerp(originalPostion, targetPostion, Mathfx.SmoothStep(0, 1, time / 2.5f));
            time += Time.deltaTime;
            yield return(null);
        }

        transform.localPosition = targetPostion;
    }
コード例 #2
0
    private float DoLerp()
    {
        switch (this._currentLerpType)
        {
        case LerpType.Lerp: return(Mathfx.Lerp(this.From, this.To, this.LerpZeroToOne));

        case LerpType.Hermite: return(Mathfx.Lerp(this.From, this.To, this.LerpZeroToOne));

        case LerpType.Sinerp: return(Mathfx.Sinerp(this.From, this.To, this.LerpZeroToOne));

        case LerpType.Coserp: return(Mathfx.Coserp(this.From, this.To, this.LerpZeroToOne));

        case LerpType.Berp: return(Mathfx.Berp(this.From, this.To, this.LerpZeroToOne));

        case LerpType.Smoothstep: return(Mathfx.SmoothStep(this.From, this.To, this.LerpZeroToOne));

        case LerpType.Clerp: return(Mathfx.Clerp(this.From, this.To, this.LerpZeroToOne));

        default: throw new ArgumentOutOfRangeException();
        }
    }