-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
117 lines (91 loc) · 2.84 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
title: rotateX()
slug: Web/CSS/transform-function/rotateX
---
{{CSSRef}}
**`rotateX()`** 函数定义了一个转换,它可以让一个元素围绕横坐标 (水平轴) 旋转,而不会对其进行变形。它的结果是一个{{cssxref("<transform-function>")}}数据类型。
{{EmbedInteractiveExample("pages/css/function-rotateX.html")}}
旋转轴围绕原点旋转,而这个原点通过{{cssxref("transform-origin")}} 属性来定义。
> **备注:** `rotateX(a)` 相当于 `rotate3d(1, 0, 0, a)`.
> **备注:** 与二维平面上的旋转不同,三维旋转的组合通常是不可交换的。换句话说,三维旋转的应用顺序,将会影响最终结果。
## 语法
**`rotateX()`** 引起的旋转量由{{cssxref("<angle>")}}指定。如果为正,则顺时针方向移动;如果为负,则逆时针方向移动。
```
rotateX(a)
```
### 参数值
- `a`
- : `a` 是一个{{cssxref("<angle>")}} ,表示旋转的角度。正数角度表示顺时针旋转,负数则表示逆时针旋转。
<table class="standard-table">
<thead>
<tr>
<th scope="col">笛卡儿坐标 ℝ<sup>2</sup></th>
<th scope="col">齐次坐标 ℝℙ<sup>2</sup></th>
<th scope="col">笛卡儿坐标 ℝ<sup>3</sup></th>
<th scope="col">齐次坐标 ℝℙ<sup>3</sup></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">
This transformation applies to the 3D space and can't be represented on
the plane.
</td>
<td colspan="1">
<math
><mfenced
><mtable
><mtr><mtd>1</mtd><mtd>0</mtd><mtd>0</mtd></mtr
><mtr><mtd>0</mtd><mtd>cos(a)</mtd><mtd>-sin(a)</mtd></mtr
><mtr><mtd>0</mtd><mtd>sin(a)</mtd><mtd>cos(a)</mtd></mtr></mtable
></mfenced
></math
>
</td>
<td colspan="1">
<math
><mfenced
><mtable
><mtr><mtd>1</mtd><mtd>0</mtd><mtd>0</mtd><mtd>0</mtd></mtr
><mtr
><mtd>0</mtd><mtd>cos(a)</mtd><mtd>-sin(a)</mtd
><mtd>0</mtd></mtr
><mtr
><mtd>0</mtd><mtd>sin(a)</mtd><mtd>cos(a)</mtd><mtd>0</mtd></mtr
><mtr
><mtd>0</mtd><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr
></mtable
></mfenced
></math
>
</td>
</tr>
</tbody>
</table>
## 示例
### HTML
```html
<div>Normal</div>
<div class="rotated">Rotated</div>
```
### CSS
```css
div {
width: 80px;
height: 80px;
background-color: skyblue;
}
.rotated {
transform: rotateX(45deg);
background-color: pink;
}
```
### 结果
{{EmbedLiveSample("示例", "auto", 180)}}
## 规范
{{Specifications}}
## 浏览器兼容性
{{Compat}}
## 参见
- {{cssxref("transform")}}
- {{cssxref("<transform-function>")}}