美文网首页
0-1(normalizedTime)转化为0-1-0的曲线

0-1(normalizedTime)转化为0-1-0的曲线

作者: jojo911 | 来源:发表于2018-12-14 13:35 被阅读0次

0-1(normalizedTime)转化为0-1-0的曲线
yOffset 的值是从0,到height,再到0

public class TempToTest : MonoBehaviour
{
    void Start ()
    {
        StartCoroutine(Parabola(1, 1));
    }
    
    void Update ()
    {
        
    }

    IEnumerator Parabola(float height, float duration)
    {
        float normalizedTime = 0.0f;
        while (normalizedTime < 1.0f)
        {
            float yOffset = height * 4.0f * (normalizedTime - normalizedTime * normalizedTime);
            normalizedTime += Time.deltaTime / duration;

            Debug.Log(yOffset);

            yield return null;
        }
    }
}

相关文章

网友评论

      本文标题:0-1(normalizedTime)转化为0-1-0的曲线

      本文链接:https://www.haomeiwen.com/subject/jefghqtx.html