15 lines
305 B
JavaScript
15 lines
305 B
JavaScript
|
|
module.exports = fromValues
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Creates a new vec2 initialized with the given values
|
||
|
|
*
|
||
|
|
* @param {Number} x X component
|
||
|
|
* @param {Number} y Y component
|
||
|
|
* @returns {vec2} a new 2D vector
|
||
|
|
*/
|
||
|
|
function fromValues(x, y) {
|
||
|
|
var out = new Float32Array(2)
|
||
|
|
out[0] = x
|
||
|
|
out[1] = y
|
||
|
|
return out
|
||
|
|
}
|