animate动画库使用
一、引用
1.cdm的引用方式:
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/animate.css/3.1.1/animate.min.css">
2.npm安装
npm install animate -D
二、使用
动态效果的总集:animate.css
//引用之后
<div class="animated 你想要的动态效果">2312312</div>
四方体
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
.wrapper {
width: 200px;
height: 200px;
margin: 100px auto;
position: relative;
transform-style: preserve-3d;
animation: 3s rorate infinite;
}
.wrapper > div {
position: absolute;
opacity: 0.8;
}
.wrapper img {
width: 200px;
height: 200px;
vertical-align: top;
}
.wrapper > .box1 {
transform: rotateY(90deg) translateZ(100px);
}
.wrapper > .box2 {
transform: rotateY(90deg) translateZ(-100px);
}
.wrapper > .box3 {
transform: rotateX(90deg) translateZ(-100px);
}
.wrapper > .box4 {
transform: rotateX(90deg) translateZ(100px);
}
.wrapper > .box5 {
transform: translateZ(100px);
}
.wrapper > .box6 {
transform: translateZ(-100px);
}
@keyframes rorate {
from {
transform: rotateY(0deg) rotateZ(0deg);
}
to {
transform: rotateY(360deg) rotateZ(360deg);
}
}
</style>
</head>
<body>
<div class="wrapper">
<div class="box1"><img src="./img1.jpg" alt="" /></div>
<div class="box2"><img src="./img2.jpg" alt="" /></div>
<div class="box3"><img src="./img3.jpg" alt="" /></div>
<div class="box4"><img src="./img4.jpg" alt="" /></div>
<div class="box5"><img src="./img5.jpg" alt="" /></div>
<div class="box6"><img src="./img6.jpg" alt="" /></div>
</div>
</body>
</html>