* 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 (Vector2d treats `z` as 0) * @param lambda - decay rate in `1/second
( target: Vector2d | Vector3d | ObservableVector3d, lambda: number, dt: number, )
| 486 | * @returns Reference to this object for method chaining |
| 487 | */ |
| 488 | damp( |
| 489 | target: Vector2d | Vector3d | ObservableVector3d, |
| 490 | lambda: number, |
| 491 | dt: number, |
| 492 | ) { |
| 493 | this.set( |
| 494 | damp(this.x, target.x, lambda, dt), |
| 495 | damp(this.y, target.y, lambda, dt), |
| 496 | damp(this.z, "z" in target ? target.z : 0, lambda, dt), |
| 497 | ); |
| 498 | return this; |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * interpolate the position of this vector on the x and y axis towards the given one by the given maximum step. |