SVGTransform: setSkewX() 方法
SVGTransform 接口的 setSkewX() 方法将变换类型设置为 SVG_TRANSFORM_SKEWX,参数 angle 定义了 X 轴上的倾斜量。
语法
js
setSkewX(angle)
参数
angle-
一个浮点数,定义了倾斜的角度(以度为单位)。
返回值
无(undefined)。
异常
NoModificationAllowedErrorDOMException-
如果属性或
SVGTransform对象是只读的,则抛出此异常。
示例
沿 X 轴倾斜 SVG 元素
js
// Select an SVG element and create a transform object
const svgElement = document.querySelector("svg");
const transform = svgElement.createSVGTransform();
// Apply a skew of 30 degrees along the X-axis
transform.setSkewX(30);
// Log the applied transformation angle
console.log(`Skew Angle: ${transform.angle}`); // Output: 30
规范
| 规范 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGTransform__setSkewX |
浏览器兼容性
加载中…