Movatterモバイル変換


[0]ホーム

URL:


  1. 開発者向けのウェブ技術
  2. SVG
  3. リファレンス
  4. 属性
  5. maskContentUnits

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

View in EnglishAlways switch to English

maskContentUnits

Baseline Widely available

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

maskContentUnits 属性は、<mask> 要素のコンテンツに使用する座標系を示します。

この属性は、次の SVG 要素で使用することができます。

html,body,svg {  height: 100%;}
html
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">  <mask maskContentUnits="userSpaceOnUse">    <rect fill="black" x="0" y="0" width="100%" height="100%" />    <circle fill="white" cx="50" cy="50" r="35" />  </mask>  <mask maskContentUnits="objectBoundingBox">    <rect fill="black" x="0" y="0" width="100%" height="100%" />    <circle fill="white" cx=".5" cy=".5" r=".35" />  </mask>  <!-- Some reference rect to materialized the mask -->  <rect x="0" y="0" width="45" height="45" />  <rect x="0" y="55" width="45" height="45" />  <rect x="55" y="55" width="45" height="45" />  <rect x="55" y="0" width="45" height="45" />  <!-- The first 3 rect are masked with useSpaceOnUse units -->  <use mask="url(#myMask1)" href="#r1" fill="red" />  <use mask="url(#myMask1)" href="#r2" fill="red" />  <use mask="url(#myMask1)" href="#r3" fill="red" />  <!-- The last rect is masked with objectBoundingBox units -->  <use mask="url(#myMask2)" href="#r4" fill="red" /></svg>

mask

<mask> では、maskContentUnits は、要素のコンテンツに使用されている座標系を定義します。

userSpaceOnUse |objectBoundingBox
既定値userSpaceOnUse
アニメーション
userSpaceOnUse

この値は、この<mask> 要素内のすべての座標が、マスクの作成時に定義されたユーザー座標系を参照することを示します。

objectBoundingBox

この値は、この<mask> 要素内のすべての座標が、マスクが適用される要素の境界ボックスを基準としていることを示します。境界ボックスは、<mask> のコンテンツが"0 0 1 1"viewBox に結び付けられている場合と同じと考えることができます。

仕様書

Specification
CSS Masking Module Level 1
# element-attrdef-mask-maskcontentunits

ブラウザーの互換性

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp