Answers for "what is javascript lerp"

1

javascript lerp

export function lerp(v0, v1, amt, maxMove = 0, minDiff = 0.0001) {
	let diff = v1 - v0;
	if (maxMove > 0) {
		diff = Math.min(diff, maxMove);
		diff = Math.max(diff, -maxMove);
	}
	if (Math.abs(diff) < minDiff) {
		return v1;
	}
	return v0 + diff * amt;
};

export default lerp;
Posted by: Guest on April-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language