ixfx
    Preparing search index...

    Function immutable

    • Wrapper for bipolar-based values. Immutable. All functions will clamp to keep it in legal range.

      let v = immutable(); // Starts with 0 by default
      v = v.add(0.1); // v.value is 0.1
      v = v.inverse(); // v.value is -0.1
      v = v.multiply(0.2); // v.value is -0.02

      v = immutable(1);
      v = v.towardZero(0.1); // 0.9
      v = v.interpolate(0.1, 1);

      Wrapped values can be coerced into number:

      const v = immutable(1);
      const x = +v+10;
      // x = 11

      Parameters

      • startingValueOrBipolar: number | BipolarWrapper = 0

        Initial numeric value or BipolarWrapper instance

      Returns BipolarWrapper