matrix()
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æ.
matrix() 㯠CSS ã®é¢æ°ã§ãäºæ¬¡å
忬¡å¤æè¡åãå®ç¾©ãã¾ããçµæã¯ <transform-function> ãã¼ã¿åã«ãªãã¾ãã
ã¡ã¢:
matrix(a, b, c, d, tx, ty) 㯠matrix3d(a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1) ã®ç縮形ã§ãã
試ãã¦ã¿ã¾ããã
transform: matrix(1.2, 0.2, -1, 0.9, 0, 20);
transform: matrix(0.4, 0, 0.5, 1.2, 60, 10);
transform: matrix(0, 1, 1, 0, 0, 0);
transform: matrix(0.1, 1, -0.3, 1, 0, 0);
<section id="default-example">
<img
class="transition-all"
id="example-element"
src="/proxy/developer.mozilla.org/shared-assets/images/examples/firefox-logo.svg"
width="200" />
</section>
æ§æ
matrix(a, b, c, d, tx, ty)
å¤
matrix() 颿°ã¯ 6 ã¤ã®å¤ã§æå®ããã¾ãã宿°ã¯å
èµããã¦ãã¦å¼æ°ã¨ãã¦ã¯æ¸¡ãããããã®ä»ã®å¼æ°ã¯ååªå
ã®é ã§è¨è¿°ããã¾ãã
- a b c d
-
<number>ã§ãç·å½¢å¤æãè¨è¿°ãã¾ãã - tx ty
-
<number>ã§ãé©ç¨ãã夿ãè¨è¿°ãã¾ãã
| ç´äº¤åº§æ¨ç³» (â^2) | 忬¡åº§æ¨ç³» (ââ^2) | ç´äº¤åº§æ¨ç³» (â^3) | 忬¡åº§æ¨ç³» (ââ^3) |
|---|---|---|---|
|
|
|
|
|
[a b c d tx ty] |
å¤ã¯æ¬¡ã®é¢æ°ã表ãã¾ãã
matrix(scaleX(), skewY(), skewX(), scaleY(), translateX(), translateY())
形弿æ³
<matrix()> =
matrix( <number>#{6} )
ä¾
>HTML
<div>é常</div>
<div class="changed">夿´å¾</div>
CSS
div {
width: 80px;
height: 80px;
background-color: skyblue;
}
.changed {
transform: matrix(1, 2, -1, 1, 80, 80);
background-color: pink;
}
çµæ
仿§æ¸
| Specification |
|---|
| CSS Transforms Module Level 1> # funcdef-transform-matrix> |
ãã©ã¦ã¶ã¼ã®äºææ§
é¢é£æ å ±
transform- ç¬ç«ãã座æ¨å¤æããããã£:
<transform-function>matrix3d()