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 |
瀏覽器相容性
載入中…