ReferenceScripting APIMotionMathsdamp
MotionMaths.damp
methodA value followed toward a target, the same whatever the frame rate.
| Name | damp |
|---|---|
| Kind | method of MotionMaths |
| Called as | maths.damp(…) |
| As a node | Smooth Follow (logic graph) |
| Since | 0.4 |
Syntax
damp( current: number, target: number, smoothing: number, dt: number): numberParameters
| Name | Type | Description |
|---|---|---|
current | number | Where it is |
target | number | Where it's going |
smoothing | number | Seconds it takes to get most of the way (about 63%) |
dt | number | Seconds since the last time (tick's dt) |
Returns
number: where it is now.
Example
let level = 0;scene.on("tick", (time, dt) => { level = scene.maths.damp(level, scene.audio.level, 0.3, dt); });Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.