From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../css/transform-function/rotatez()/index.html | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 files/zh-cn/web/css/transform-function/rotatez()/index.html (limited to 'files/zh-cn/web/css/transform-function/rotatez()') diff --git a/files/zh-cn/web/css/transform-function/rotatez()/index.html b/files/zh-cn/web/css/transform-function/rotatez()/index.html new file mode 100644 index 0000000000..b7fc6b5da2 --- /dev/null +++ b/files/zh-cn/web/css/transform-function/rotatez()/index.html @@ -0,0 +1,107 @@ +--- +title: rotateZ() +slug: Web/CSS/transform-function/rotateZ() +translation_of: Web/CSS/transform-function/rotateZ() +--- +
{{CSSRef}}
+ +

rotateZ() 函数定义了一个转换,它可以让一个元素围绕横Z轴旋转,而不会对其进行变形。它的结果是一个{{cssxref("<transform-function>")}}数据类型。

+ +
{{EmbedInteractiveExample("pages/css/function-rotateZ.html")}}
+ + + +

旋转轴围绕原点旋转,而这个原点通过{{cssxref("transform-origin")}} 属性来定义。

+ +
+

注意: rotateZ(a) 相当于 rotate(a) or rotate3d(0, 0, 1, a)

+
+ +
注意: 与二维平面上的旋转不同,三维旋转的组合通常是不可交换的。换句话说,三维旋转的应用顺序,将会影响最终结果。
+ +

语法

+ +

rotateZ() 引起的旋转量由{{cssxref("<angle>")}}指定。如果为正,则顺时针方向移动;如果为负,则逆时针方向移动。

+ +
rotateZ(a)
+
+ +

参数值

+ +
+
a
+
a 是一个{{cssxref("<angle>")}} ,表示旋转的角度。正数角度表示顺时针旋转,负数则表示逆时针旋转。
+
+ + + + + + + + + + + + + + + + + +
笛卡儿坐标 ℝ2齐次坐标 ℝℙ2笛卡儿坐标 ℝ3齐次坐标 ℝℙ3
This transformation applies to the 3D space and can't be represented on the plane. cos(a)-sin(a)0sin(a)cos(a)0001 cos(a)-sin(a)00 sin(a)cos(a)00 0010 0001
+ +

示例

+ +

HTML

+ +
<div>Normal</div>
+<div class="rotated">Rotated</div>
+ +

CSS

+ +
div {
+  width: 80px;
+  height: 80px;
+  background-color: skyblue;
+}
+
+.rotated {
+  transform: rotateZ(45deg);
+  background-color: pink;
+}
+
+ +

结果

+ +

{{EmbedLiveSample("示例", "auto", 180)}}

+ +

规范

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName("CSS Transforms 2", "#funcdef-rotatez", "rotateZ()")}}{{Spec2("CSS Transforms 2")}}Initial definition
+ +

浏览器兼容

+ +

有关兼容性信息,请参阅 <transform-function> 的数据类型。

+ +

另请参阅

+ + -- cgit v1.2.3-54-g00ecf