I need to make a picture box to lerp from position to position (like you can do that in unity).
How can I do that , is there a built-in function?
thanks :)
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Try this instead
Linear interpolation (lerp) is actually a pretty easy function to implement. The equation is
A higher order Lerp just wraps lower order lerps:
The DirectX SDK has all manner of math functions like Unity, but that's a lot of overhead to bring in just for Lerp. You're probably best off just implementing your own.
Greg Bahm wrote inverted lerp equation
firstFloat * by + secondFloat * (1 - by)
, where firstFloat is the secondFloat and secondFloat is the firstFloat.In fact, corrent lerp equation is:
firstFloat * (1 - by) + secondFloat * by
But the fastest way to linear interpolation is:
firstFloat + (secondFloat - firstFloat) * by
That's 2 additions/subtractions and 1 multiplication instead of 2 addition/subtractions and 2 multiplications. Lerp for Vector2 is correct.