Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Last active June 27, 2022 04:30
Show Gist options
  • Select an option

  • Save kobitoDevelopment/67086d985cfcdcf07de485e64107c874 to your computer and use it in GitHub Desktop.

Select an option

Save kobitoDevelopment/67086d985cfcdcf07de485e64107c874 to your computer and use it in GitHub Desktop.
<p class="hoge">transformテスト</p>
const hoge = document.querySelector(".hoge");
const hogeStyles = getComputedStyle(hoge);
let matrix = new DOMMatrix(hogeStyles.transform);
console.log("X", matrix.m41, "Y", matrix.m42, "Z", matrix.m43);
// matrixをconsoleに出力してどのkeyにどのvalueが格納されているか確認可能
.hoge {
transform: translateX(30px) translateY(40px) translateZ(50px);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment