lerp(a,b,t) is a math function that lets you find a value between two other values
- a is the first value
- b is the second value
- t is a number between 0 and 1 that decides how far between a and b you want the value to be
- 0 is all the way at a
- 1 is all the way at b
- 0.5 is halfway between
to better understand it
try this exe:
experiment with different values for a,b,t until you have a firm grasp of how it works
simply type in values for a and b, and drag the red slider to set values for t
try me!
watch the equation change, and watch the bar at the bottom
lerp can be used for everything from health bars, to color fades, smooth angle changes, to smoothly fading sound effect volume. you can also use it in a loop to set up a bunch of sprites in a neat line. there are endless uses. once you understand what it does, you'll find it comes up often as a useful tool when designing games
if you have any questions about how to do any of the above mentioned, or if lerp simply still doesn't make sense. please ask away
once you have a firm grasp on this, you can easily learn cosp, qerp, and cubic, which are even more awesome
update: here's another tutorial with qarp and cubic=
lerp/qarp/cubic tutorial
math is power