MCPcopy Create free account
hub / github.com/melonjs/melonJS / damp

Function damp

packages/melonjs/src/math/math.ts:237–244  ·  view source on GitHub ↗
(
	current: number,
	target: number,
	lambda: number,
	dt: number,
)

Source from the content-addressed store, hash-verified

235 * cameraX = math.damp(cameraX, target.x, 5, dt / 1000);
236 */
237export function damp(
238 current: number,
239 target: number,
240 lambda: number,
241 dt: number,
242): number {
243 return current + (target - current) * (1 - Math.exp(-lambda * dt));
244}
245
246/**
247 * Linearly interpolate a value from an array at the given position.

Callers 4

dampMethod · 0.90
dampMethod · 0.90
dampMethod · 0.90
dampMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected