moveTowards

fun Number.moveTowards(target: Number, maxDelta: Number): Double

Moves a current value towards target.

Return

The new value.

Parameters

target

The value to move towards.

maxDelta

The maximum change that should be applied to the value. Negative values will push the current value away from the target for potential convergence of wrapped numbers.


Same as moveTowards, but makes sure the values interpolate correctly when they wrap around 1 revolution (360 degrees).

Return

The new value.

Parameters

target

The angle to move towards.

maxDelta

The maximum change that should be applied to the value. Negative values will push the current value away from the target for potential convergence of wrapped numbers.