
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
transform-to-matrix-cli
Advanced tools
一个将 CSS transform 转换为 matrix3d 矩阵的命令行工具。
npm install -g transform-to-matrix-cli
或在项目中本地安装:
npm install transform-to-matrix-cli
直接转换指定的 transform 字符串:
tm-cli convert "translate(100px, 50px)"
启动交互式转换模式:
tm-cli interactive
# 或简写
tm-cli i
不带任何参数运行也会进入交互式模式:
tm-cli
查看使用示例:
tm-cli examples
# 或简写
tm-cli ex
✅ 支持所有 CSS transform 函数
✅ 支持组合变换
✅ 支持多种单位(px, deg, rad, turn, grad 等)
✅ 美观的命令行界面
✅ 详细的矩阵展示
# 平移
tm-cli convert "translate(100px, 50px)"
# 旋转
tm-cli convert "rotate(45deg)"
# 缩放
tm-cli convert "scale(1.5, 2)"
# 倾斜
tm-cli convert "skewX(20deg)"
# 3D旋转
tm-cli convert "rotateX(30deg) rotateY(45deg)"
# 3D平移
tm-cli convert "translateZ(100px)"
# 组合3D变换
tm-cli convert "rotateX(30deg) rotateY(45deg) translateZ(100px)"
tm-cli convert "translate(100px, 50px) rotate(45deg) scale(1.2)"
你也可以在代码中使用这个包:
const {
transformToMatrix,
transformToMatrixArray,
} = require('transform-to-matrix-cli');
// 获取 matrix3d CSS 字符串
const css = transformToMatrix('translate(100px, 50px) rotate(45deg)');
console.log(css);
// 输出: matrix3d(0.707107, 0.707107, 0, 0, -0.707107, 0.707107, 0, 0, 0, 0, 1, 0, 53.033009, 159.099026, 0, 1)
// 获取矩阵数组
const matrix = transformToMatrixArray('rotate(45deg)');
console.log(matrix);
// 输出: [0.707107, 0.707107, 0, 0, -0.707107, 0.707107, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
转换结果包含:
示例输出:
输入:
translate(100px, 50px)
输出:
matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 50, 0, 1)
矩阵详情:
4x4 矩阵:
[ 1.000000, 0.000000, 0.000000, 0.000000]
[ 0.000000, 1.000000, 0.000000, 0.000000]
[ 0.000000, 0.000000, 1.000000, 0.000000]
[ 100.000000, 50.000000, 0.000000, 1.000000]
ISC
FAQs
将 CSS transform 转换为 matrix3d 矩阵的命令行工具
We found that transform-to-matrix-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.