Pushes a bipolar value toward zero by amount. Return value is clamped on bipolar range of -1..1
amount
import { Bipolar } from 'https://unpkg.com/ixfx/dist/data.js';Bipolar.towardZero(-1, 0.1); // -0.9Bipolar.towardZero( 1, 0.1); // 0.9Bipolar.towardZero( 0, 0.1); // 0.0Bipolar.towardZero( 1, 1.1); // 0.0 Copy
import { Bipolar } from 'https://unpkg.com/ixfx/dist/data.js';Bipolar.towardZero(-1, 0.1); // -0.9Bipolar.towardZero( 1, 0.1); // 0.9Bipolar.towardZero( 0, 0.1); // 0.0Bipolar.towardZero( 1, 1.1); // 0.0
If amount is greater than 1, 0 is returned. Throws an error if bipolarValue or amount are not numbers. Throws an error if amount is below zero.
bipolarValue
Bipolar value to nudge toward zero
Amount to nudge by
Bipolar value -1...1
Pushes a bipolar value toward zero by
amount
. Return value is clamped on bipolar range of -1..1If
amount
is greater than 1, 0 is returned. Throws an error ifbipolarValue
oramount
are not numbers. Throws an error ifamount
is below zero.