Vec2() - newo2001/HTML5-Canvas-Wrapper GitHub Wiki

Description

Creates a Vec2 object.

Syntax

new Vec2(x, [y])

x (float)

A float (or int) value to represent the length of the vector's x-component.

y (float) [optional]

A float (or int) value to represent the length of the vector's y-component. If y is not set it will be initialized with the value of the vector's x-component.

Returns

A new Vec2 with the specified lengths.

Example

let vec = new Vec2(1.5, 5);
Creates a Vector of which the x-component is 1.5 long and the y-component is 5.0 long.

Notes

  • This is the constructor for the Vec2 type.
⚠️ **GitHub.com Fallback** ⚠️