files/en-us/web/api/dommatrix/translateself/index.md
{{APIRef("Geometry Interfaces")}}{{AvailableInWorkers}}
The translateSelf() method of the {{domxref("DOMMatrix")}} interface is a mutable transformation method that modifies a matrix. It applies the specified vectors and returns the updated matrix. The default vector is [0, 0, 0].
To translate a matrix without mutating it, see {{domxref("DOMMatrixReadOnly.translate()")}}
translateSelf(translateX, translateY)
translateSelf(translateX, translateY, translateZ)
translateX
translateY
translateZ {{optional_inline}}
Returns itself; the DOMMatrix translated by the given
vector.
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.toString()); // output: "matrix(1, 0, 0, 1, 0, 0)"
matrix.translateSelf(25, 25); // mutate it
console.log(matrix); // output: "matrix(1, 0, 0, 1, 25, 25)"
{{Specifications}}
{{Compat}}
transform attribute