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

Method damp

packages/melonjs/src/math/observableVector2d.ts:428–434  ·  view source on GitHub ↗

* Frame-rate independent exponential damping toward `target`. * Per-component wrapper around damp that triggers the * change-callback exactly once via the underlying set. * @param target - vector to approach * @param lambda - decay rate in `1/seconds` (higher = snappier) *

(target: Vector2d | ObservableVector2d, lambda: number, dt: number)

Source from the content-addressed store, hash-verified

426 * @returns Reference to this object for method chaining
427 */
428 damp(target: Vector2d | ObservableVector2d, lambda: number, dt: number) {
429 this.set(
430 damp(this.x, target.x, lambda, dt),
431 damp(this.y, target.y, lambda, dt),
432 );
433 return this;
434 }
435
436 /**
437 * interpolate the position of this vector towards the given one by the given maximum step.

Callers

nothing calls this directly

Calls 2

setMethod · 0.95
dampFunction · 0.90

Tested by

no test coverage detected