ixfx
    Preparing search index...

    Function towardZero

    • Pushes a bipolar value toward zero by amount. Return value is clamped on bipolar range of -1..1

      import { Bipolar } from 'https://unpkg.com/ixfx/dist/data.js';
      Bipolar.towardZero(-1, 0.1); // -0.9
      Bipolar.towardZero( 1, 0.1); // 0.9
      Bipolar.towardZero( 0, 0.1); // 0.0
      Bipolar.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.

      Parameters

      • bipolarValue: number

        Bipolar value to nudge toward zero

      • amount: number

        Amount to nudge by

      Returns number

      Bipolar value -1...1