mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Added copyToArray method.
This commit is contained in:
parent
0516fd47f7
commit
05a6275d9a
1 changed files with 34 additions and 0 deletions
|
@ -621,6 +621,40 @@ var TransformMatrix = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Copy the values in this Matrix to the array given.
|
||||
*
|
||||
* Where array indexes 0, 1, 2, 3, 4 and 5 are mapped to a, b, c, d, e and f.
|
||||
*
|
||||
* @method Phaser.GameObjects.Components.TransformMatrix#copyToArray
|
||||
* @since 3.12.0
|
||||
*
|
||||
* @param {array} [out] - The array to copy the matrix values in to.
|
||||
*
|
||||
* @return {array} An array where elements 0 to 5 contain the values from this matrix.
|
||||
*/
|
||||
copyToArray: function (out)
|
||||
{
|
||||
var matrix = this.matrix;
|
||||
|
||||
if (out === undefined)
|
||||
{
|
||||
out = [ matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5] ];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
out[0] = matrix[0];
|
||||
out[1] = matrix[1];
|
||||
out[2] = matrix[2];
|
||||
out[3] = matrix[3];
|
||||
out[4] = matrix[4];
|
||||
out[5] = matrix[5];
|
||||
}
|
||||
|
||||
return out;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the values of this Matrix.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue