初学css的小伙伴一定会好奇那些简单的动画是怎么做的,那么来学习一下rotate3d()里面的参数到底是啥意思
基本语法
transform: rotate3d(x,y,z,angle);
x
<number> 类型, 表示旋转轴X坐标方向的矢量。
y
<number> 类型, 表示旋转轴Y坐标方向的矢量。
z
<number> 类型, 表示旋转轴Z坐标方向的矢量。
a
<angle> 类型,表示旋转角度。正的角度值表示顺时针旋转,负值表示逆时针旋转。
实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
div{
border:5px solid black;
background-color:yellow;
width:100px;height:100px;
/*transform:rotate3d(0,0,1,20deg);*/
transition-timing-function:ease;
transition:width 2s,height 2s, transform 2s,background 2s,font-size 2s,opacity 2s;
}
div:hover{
width:200px;
height:200px;
transform:rotate(720deg);
background-color:red;
font-size:32px;
opacity:100;
}
</style>
</head>
<body>
<div>what?</div>
</body>
</html>
网友评论