vec2-fn
    Preparing search index...

    Function add

    • Add vectors together.

      Type Parameters

      Parameters

      • target: T

        Target vector.

      • value: number | Vec2Param

        The vector to add.

      Returns T

      • A reference to the modified target object.

      Error - When a computed component is NaN or non-finite.

      add({ x: -1, y: -1 }, { x: 1, y: 1 }); // -> { x: 0, y: 0 }
      
    • Add vectors together.

      Type Parameters

      Parameters

      • target: Vec2Param

        Target vector.

      • value: number | Vec2Param

        The vector to add.

      • dest: D

        Destination object to store the result.

      Returns D

      • A reference to the modified destination object.

      Error - When a computed component is NaN or non-finite.

      let result = { x: 0, y: 0 };

      add({ x: -1, y: -1 }, { x: 1, y: 1 }, result); // -> { x: 0, y: 0 }