From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/fr/web/svg/attribute/mask/index.html | 86 ++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 files/fr/web/svg/attribute/mask/index.html (limited to 'files/fr/web/svg/attribute/mask') diff --git a/files/fr/web/svg/attribute/mask/index.html b/files/fr/web/svg/attribute/mask/index.html new file mode 100644 index 0000000000..a3145cc508 --- /dev/null +++ b/files/fr/web/svg/attribute/mask/index.html @@ -0,0 +1,86 @@ +--- +title: mask +slug: Web/SVG/Attribute/mask +translation_of: Web/SVG/Attribute/mask +--- +
{{SVGRef}}
+ +

L'attribut mask est un attribut de présentation principalement utilisé pour appliquer un trou (défini par un élément {{ SVGElement("mask") }}) sur l'élément qui possède cet attribut.

+ +

Note: On peut aussi utiliser l'attribut {{cssxref('mask')}} en CSS.

+ +
+ + +
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
+  <mask id="monMask" maskContentUnits="objectBoundingBox">
+    <rect    fill="white" x="0" y="0" width="100%" height="100%" />
+    <polygon fill="black" points="0.5,0.2 0.68,0.74 0.21,0.41 0.79,0.41 0.32,0.74" />
+  </mask>
+
+  <!-- Fait un trou de la forme d'une étoile sur le cercle rouge,
+  ce qui laisse apparaître le cercle jaune situé dessous. -->
+  <circle cx="50" cy="50" r="20" fill="yellow" />
+  <circle cx="50" cy="50" r="45" fill="red"
+          mask="url(#monMask)"/>
+</svg>
+ +

{{EmbedLiveSample('topExample', '100%', 150)}}

+
+ +

Depuis SVG2, l'attribut {{cssxref('mask')}} est défini comme une propriété CSS et comme une propriété raccourcie pour beaucoup d'autres propriétés: {{cssxref('mask-image')}}, {{cssxref('mask-mode')}}, {{cssxref('mask-repeat')}}, {{cssxref('mask-position')}}, {{cssxref('mask-clip')}}, {{cssxref('mask-origin')}}, {{cssxref('mask-size')}} et {{cssxref('mask-composite')}}.

+ +

Étant un attribut de présentation, il peut être appliqué sur n'importe quel élément, mais il a un effet visible surtout sur les éléments suivants: {{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('ellipse')}}, {{SVGElement('g')}}, {{SVGElement('glyph')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('marker')}}, {{SVGElement('mask')}}, {{SVGElement('path')}}, {{SVGElement('pattern')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('svg')}}, {{SVGElement('symbol')}}, {{SVGElement('text')}} et {{SVGElement('use')}}.

+ +

Contexte d'utilisation

+ + + + + + + + + + + + + + + + +
ValeurVoir la propriété CSS {{cssxref('mask')}}
Valeur par défautnone
AnimableOui
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("svg.attributes.presentation.mask")}}

+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + + + +
SpécificationStatusCommentaire
{{SpecName("CSS Masks", "#the-mask", 'mask')}}{{Spec2("CSS Masks")}} +

Étend cet usage pour les éléments HTML en créant un raccourci pour les nouvelles propriétés mask-* défini dans cette spécification.

+
{{SpecName('SVG1.1', 'masking.html#MaskProperty', 'mask')}}{{Spec2('SVG1.1')}}Définition initiale
-- cgit v1.2.3-54-g00ecf