我已经创建了一个从1到0的PingPong帮助器,但是我很难反转它,所以值从1到0。
下面你可以看到我目前正在使用的代码。我也不确定这是否可能。
_lerpPulse = PingPong(Time.time * 0.5f, 0f, 1f);和帮助者
float PingPong(float aValue, float aMin, float aMax)
{
return Mathf.PingPong(aValue, aMax - aMin) + aMin;
}提前感谢!
发布于 2020-05-05 19:37:07
Mathf.PingPong创建了一个这样的图

因此,要从峰值开始,可以将沿x轴到峰值的距离添加到时间参数中,它将是sqrt(2)/2 *长度,或0.707 *长度
float PingPong1To0(float aValue, float aMin, float aMax)
{
float offset 0.707f * (aMax - aMin); // sqrt(2)/2
return Mathf.PingPong(aValue +offset, aMax - aMin) + aMin;
}应该会碰到那个三角形的下落边
https://stackoverflow.com/questions/61603070
复制相似问题