mathApproach

Moves current value towards target by a maximum step amount. Takes current (starting value), target (destination value), step (maximum movement per call). Returns a value moved from current towards target by at most step units.

Mathematics

Parameters & Returns

Parameters

current Double
target Double
step Double

Returns

Double

Quick Summary

Moves current value towards target by a maximum step amount. Takes current (starting value), target (destination value), step (maximum movement per call). Returns a value moved from current towards target by at most step units.

Technical Exegesis...

Returns a value moved from current towards target by at most step units. If the distance to target is less than step, returns target exactly.

Commonly used for smooth movement, camera following, or gradually changing values. The step should be positive; the function handles the direction automatically.

Example

Example.bam
; No example implemented yet