| 类别 | 说明 |
|---|---|
| translateX(tx) | X轴位移 - horizontally on the 2D plane |
| translateY(ty) | Y轴位移 - vertically on the 2D plane |
| translateZ(tz) | Z轴位移 - along the z-axis in 3D space |
| translate(tx [, ty]) | 1个参数,沿x轴;2个参数,分别沿着x轴、y轴 - in the horizontal and/or vertical directions |
| translate3d(tx, ty, tz) | 3D位移 - in 3D space |
| 类别 | 说明 |
|---|---|
| scaleX(factor) | X轴缩放 - along the x-axis |
| scaleY(factor) | Y轴缩放 - along the y-axis |
| scaleZ(factor) | Z轴缩放 - along the z-axis |
| scale(factorX[, factorY]) | 2D平面缩放 - on the 2D plane / only scales in 2D |
| scale3d(factorX, factorY, factorZ) | 3D缩放 - in 3D space |
| 类别 | 说明 |
|---|---|
| rotateX(angle) | X轴旋转 - around the x-axis |
| rotateY(angle) | Y轴旋转 - around the y-axis |
| rotateZ(angle) | Z轴旋转 - around the z-axis |
| rotate(angle) | 2D平面旋转 - on the 2D plane;相当于 rotateZ(angle) |
| rotate3d(x, y, z, a) | 3D旋转 - specified by three numbers and one angle |
| 类别 | 说明 |
|---|---|
| skewX(angleX) | X轴倾斜 - in the horizontal direction on the 2D plane |
| skewY(angleY) | Y轴倾斜 - in the vertical direction on the 2D plane |
| skew(angleX [, angleY]) | 1个参数:沿x轴方向;2个参数,分别沿x轴、y轴方向 |
.super {
perspective: 1000px;
}
.self {
transform-style: preserve-3d;
}
transform: rotateY(calc(180deg + var(--rot) * 60deg)) translateZ(calc(-1*var(--z)));
:root {
--z: 1000px;
--ar: 16/9;
}
@media screen and (max-width: 768px) {
:root {
--z: 400px;
--ar: 9/16;
}
}
VanillaTilt.init(document.querySelector(".van-box"), {
max: 50,
speed: 400
});