lerp的用法问题

lerp
线性插值。
to Vec2
ratio number the interpolation coefficient
out Vec2 optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created

以上是官方文档,其中ratio这个参数到底是什么意思呢?我就想实现一个人物移动平滑插值,比如A点移动到B点,curPostion=lerp.(A,B,ratio),现在游戏帧率不是不稳定的抖动,我这个ratio填多少呢?我看有的教程里填dt,直接填dt移动好慢,放大一点又移动有瞬闪的情况,没有做到特别的平滑

刚试了下dt*speed效果不错,speed就是角色移动速度,我按照U3D的理解做的。不知道是否是这样。

速度上是是

咚咚咚咚多多多多

的点点滴滴多多多多

proto.lerp = function (to, ratio, out) {
out = out || new Vec2();
var x = this.x;
var y = this.y;
out.x = x + (to.x - x) * ratio;
out.y = y + (to.y - y) * ratio;
return out;
};
你看他的实现,你就知道ratio是什么意思了