纯css实现翻书动画特效
代码语言:html
所属分类:动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Pure CSS Book Loader</title>
<style>
.book {
--color: #fff;
--duration: 6.8s;
width: 32px;
height: 12px;
position: relative;
margin: 32px 0 0 0;
zoom: 1.5;
}
.book .inner {
width: 32px;
height: 12px;
position: relative;
-webkit-transform-origin: 2px 2px;
transform-origin: 2px 2px;
-webkit-transform: rotateZ(-90deg);
transform: rotateZ(-90deg);
-webkit-animation: book var(--duration) ease infinite;
animation: book var(--duration) ease infinite;
}
.book .inner .left,
.book .inner .right {
width: 60px;
height: 4px;
top: 0;
border-radius: 2px;
background: var(--color);
position: absolute;
}
.book .inner .left:before,
.book .inner .right:before {
content: '';
width: 48px;
height: 4px;
border-radius: 2px;
background: inherit;
position: absolute;
top: -10px;
left: 6px;
}
.book .inner .left {
right: 28px;
-webkit-transform-origin: 58px 2px;
transform-origin: 58px 2px;
-webkit-transform: rotateZ(90deg);
transform: rotateZ(90deg);
-webkit-animation: left var(--duration) ease infinite;
animation: left var(--duration) ease infinite;
}
.book .inner .right {
left: 28px;
-webkit-transform-origin: 2px 2px;
transform-origin: 2px 2px;
-webkit-transform: rotateZ(-90deg);
transform: rotateZ(-90deg);
-webkit-animation: right var(--duration) ease infinite;
animation: right var(--duration) ease infinite;
}
.book .inner .middle {
width: 32px;
height: 12px;
border: 4px solid var(--color);
border-top: 0;
border-radius: 0 0 9px 9px;
-webkit-transform: translateY(2px);
transform: translateY(2px);
}
.book ul {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
left: 50%;
top: 0;
}
.book ul li {
height: 4px;
border-radius: 2px;
-webkit-transform-origin: 100% 2px;
transform-origin: 100% 2px;
width: 48px;
right: 0;
top: -10px;
position: absolute;
background: var(--color);
-webkit-transform: rotateZ(0deg) translateX(-18px);
transform: rotateZ(0deg) translateX(-18px);
-webkit-animation-duration: var(--duration);
animation-duration: var(--duration);
-webkit-animation-timing-function: ease;
animation-timing-function: ease;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.book ul li:nth-child(0) {
-webkit-animation-name: page-0;
animation-name: page-0;
}
.book ul li:nth-child(1) {
-webkit-animation-name: page-1;
animation-name: page-1;
}
.book ul li:nth-child(2) {
-webkit-animation-name: page-2;
animation-name: page-2;
}
.book ul li:nth-child(3) {
-webkit-animation-name: page-3;
animation-name: page-3;
}
.book ul li:nth-child(4) {
-webkit-animation-name: page-4;
animation-name: page-4;
}
.book ul li:nth-child(5) {
-webkit-animation-name: page-5;
animation-name: page-5;
}
.book ul li:nth-child(6) {
-webkit-animation-name: page-6;
animation-name: page-6;
}
.book ul li:nth-child(7) {
-webkit-animation-name: page-7;
animation-name: page-7;
}
.book ul li:nth-child(8) {
-webkit-animation-name: page-8;
animation-name: page-8;
}
.book ul li:nth-child(9) {
-webkit-animation-name: page-9;
animation-name: page-9;
}
.book ul li:nth-child(10) {
-webkit-animation-name: page-10;
animation-name: page-10;
}
.book ul li:nth-child(11) {
-webkit-animation-name: page-11;
animation-name: page-11;
}
.book ul li:nth-child(12) {
-webkit-animation-name: page-12;
animation-name: page-12;
}
.book ul li:nth-child(13) {
-webkit-animation-name: page-13;
animation-name: page-13;
}
.book ul li:nth-child(14) {
-webkit-animation-name: page-14;
animation-name: page-14;
}
.book ul li:nth-child(15) {
-webkit-animation-name: page-15;
animation-name: page-15;
}
.book ul li:nth-child(16) {
-webkit-animation-name: page-16;
animation-name: page-16;
}
.book ul li:nth-child(17) {
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0