← 返回首页
SVGTransform: type プロパティ - Web API | MDN

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

SVGTransform: type プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

typeSVGTransform インターフェイスの読み取り専用プロパティで、このインターフェイスで定義されている SVG_TRANSFORM_* 定数のいずれかによって指定される、適用された座標変換の type を表します。

In this article

整数です。値の型を unsigned short で表します。

座標変換の種類を特定

html
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <rect id="rect" x="50" y="50" width="100" height="100" fill="blue" /> </svg>
js
const rect = document.getElementById("rect"); const transformList = rect.transform.baseVal; // 移動の座標変換を作成して追加 const translateTransform = rect.ownerSVGElement.createSVGTransform(); translateTransform.setTranslate(20, 30); transformList.appendItem(translateTransform); // 追加された座標変換の種類をチェック console.log(transformList.getItem(0).type); // 出力: 2 (SVG_TRANSFORM_TRANSLATE)

仕様書

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGTransform__type

ブラウザーの互換性

Enable JavaScript to view this browser compatibility table.