transformation-matrix
Version:
2d transformation matrix functions written in ES6 syntax. Tree shaking ready!
22 lines (21 loc) • 391 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.translate = translate;
/**
* Calculate a translate matrix
* @param tx {number} Translation on axis x
* @param [ty = 0] {number} Translation on axis y
* @returns {Matrix} Affine Matrix
*/
function translate(tx, ty = 0) {
return {
a: 1,
c: 0,
e: tx,
b: 0,
d: 1,
f: ty
};
}
;