valhalla / frontend /src /utils /lerp.js
Dontcryx_07
final
d660fa9
Raw History Blame Contribute Delete
454 Bytes
/**
* lerp — exponential interpolation helper for canvas motion.
*
* Moves a value a fixed fraction of the way toward a target each frame,
* producing smooth ease-out movement between tick snapshots.
*
* Architecture: used by SimCanvas to animate agents and camera.
*
* Design: a pure function with no state; callers hold the current value.
*/
export function lerp(current, target, factor) {
return current + (target - current) * factor;
}