26 lines
589 B
JavaScript
26 lines
589 B
JavaScript
'use strict';
|
|
|
|
"use strict";
|
|
function applyMatrix(array, stride, offset, matrix) {
|
|
let index = 0;
|
|
const size = array.length / (stride || 2);
|
|
const a = matrix.a;
|
|
const b = matrix.b;
|
|
const c = matrix.c;
|
|
const d = matrix.d;
|
|
const tx = matrix.tx;
|
|
const ty = matrix.ty;
|
|
offset *= stride;
|
|
while (index < size) {
|
|
const x = array[offset];
|
|
const y = array[offset + 1];
|
|
array[offset] = a * x + c * y + tx;
|
|
array[offset + 1] = b * x + d * y + ty;
|
|
offset += stride;
|
|
index++;
|
|
}
|
|
}
|
|
|
|
exports.applyMatrix = applyMatrix;
|
|
//# sourceMappingURL=applyMatrix.js.map
|