centerex()

Removes jitter around zero and applies exponential curve to number.

Applies an advanced centering transformation to the input value based on a minimum threshold, maximum range, and exponential center scaling.

If the absolute value of the input is smaller than `min`, it returns 0.

If the absolute value is greater than or equal to `max`, it returns ±1.

Otherwise, it applies a scaled transformation between the thresholds.

Syntax

centerex(value, min, max, center)

Parameters

Parameter Type Description
value Number The numeric value to transform.
min Number The lower threshold below which the value becomes zero.
max Number The upper threshold at which the value reaches ±1.
center Number The exponential scaling factor that adjusts the response curve.

Return Value

Examples

centerex(2, 3, 10, 5);  // returns 0 (below min)
centerex(5, 3, 10, 5);  // returns 0.28571429 (transformed value)
centerex(-5, 3, 10, 5); // returns -0.28571429 (transformed value)
centerex(12, 3, 10, 5); // returns 1 (above max)
centerex(-12, 3, 10, 5); // returns -1 (above max)

See also

round
roundup
floor
ceil
trunc
center
centerex