MDN self-hosted library · e01.org

CSSTransformComponent

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const translate = new CSSTranslate(CSS.px(10), CSS.px(20));

console.log(translate.is2D); // true
console.log(translate.toString()); // "translate(10px, 20px)"

const matrix = translate.toMatrix();
console.log(matrix.e, matrix.f); // 10 20