diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/mask-mode | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/mask-mode')
| -rw-r--r-- | files/zh-cn/web/css/mask-mode/index.html | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/mask-mode/index.html b/files/zh-cn/web/css/mask-mode/index.html new file mode 100644 index 0000000000..40530bfd98 --- /dev/null +++ b/files/zh-cn/web/css/mask-mode/index.html @@ -0,0 +1,114 @@ +--- +title: mask-mode +slug: Web/CSS/mask-mode +translation_of: Web/CSS/mask-mode +--- +<div>{{CSSRef}}{{SeeCompatTable}}</div> + +<p><strong><code>mask-mode</code></strong><a href="https://developer.mozilla.org/en-US/docs/Web/CSS" rel="nofollow noopener noreferrer">CSS</a>属性指示由{{cssxref("mask-image")}} 指向的遮罩被视为亮度或阿尔法遮罩。</p> + +<pre class="brush:css no-line-numbers">/* 关取值的键字 */ +mask-mode: alpha; +mask-mode: luminance; +mask-mode: match-source; + +/* 多个类型的值 */ +mask-mode: alpha, match-source; + +/* 全局变量的值 */ +mask-mode: inherit; +mask-mode: initial; +mask-mode: unset; +</pre> + +<p>{{cssinfo}}</p> + +<h2 id="语法">语法</h2> + +<p>下面列出 <code>mask-mode</code> 的一个或多个关键字值,以逗号分隔。</p> + +<h3 id="Values">Values</h3> + +<dl> + <dt><code>alpha</code></dt> + <dd>此关键字指示应使用掩码层图像的透明度(阿尔法通道)值作为掩码值。</dd> + <dt><code>luminance</code></dt> + <dd>此关键字指示掩膜层图像的亮度值应用作掩码值。</dd> + <dt><code>match-source</code></dt> + <dd> + <p>If the {{cssxref("mask-image")}} property is of type <code><mask-source></code>, the luminance values of the mask layer image should be used as the mask values.</p> + + <p>If it is of type {{cssxref("<image>")}}, the alpha values of the mask layer image should be used as the mask values.</p> + + <p>如果{{cssxref("mask-image")}}属性是<code><mask-source></code>类型,掩模层图像的亮度值会被作为掩模值。</p> + + <p>如果它是类型{{cssxref("<image>")}},掩码层图像的alpha值应用作掩码值。</p> + </dd> +</dl> + +<h3 id="正式语法">正式语法</h3> + +<pre class="syntaxbox">{{csssyntax}}</pre> + +<h2 id="示例">示例</h2> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css; highlight[6]">#masked { + width: 227px; + height: 200px; + background: blue linear-gradient(red, blue); + mask-image: url(https://mdn.mozillademos.org/files/12668/MDN.svg); + mask-mode: alpha; /* Can be changed in the live sample */ +} +</pre> + +<div class="hidden"> +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><div id="masked"> +</div> +<select id="maskMode"> + <option value="alpha">alpha</option> + <option value="luminance">luminance</option> + <option value="match-source">match-source</option> +</select> +</pre> + +<h3 id="JavaScript">JavaScript</h3> + +<pre class="brush: js">var maskMode = document.getElementById("maskMode"); +maskMode.addEventListener("change", function (evt) { + document.getElementById("masked").style.maskMode = evt.target.value; +}); +</pre> +</div> + +<h3 id="结果">结果</h3> + +<p>{{EmbedLiveSample("Example", 240, 240)}}</p> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">说明</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("CSS Masks", "#the-mask-mode", "mask-mode")}}</td> + <td>{{Spec2("CSS Masks")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("css.properties.mask-mode")}}</p> |
