纯css实现一个书本翻页动画效果代码
代码语言:html
所属分类:动画
代码描述:纯css实现一个书本翻页动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap");
:root {
--color-cover: hsl(0, 44%, 42%);
--color-cover-text: hsl(40, 64%, 80%);
--duration: 5000ms;
--initial-delay: 500ms;
}
body {
display: flex;
height: 100vh;
margin: 0;
justify-content: center;
align-items: center;
font-family: "Cormorant Garamond", Garamond, "Times New Roman", Times, serif;
font-size: 20px;
background-color: aliceblue;
}
.book {
width: 67vh;
height: 100vh;
border-radius: 0 24px 24px 0;
transform-style: preserve-3d;
transform: scale(0.5) rotateX(60deg) rotateZ(30deg);
animation: move-book var(--duration) ease-in-out forwards;
animation-delay: var(--initial-delay);
}
.page {
position: absolute;
width: 100%;
height: 100%;
background-color: antiquewhite;
background: linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent 10%) antiquewhite;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: inherit;
z-index: calc(var(--pages) - var(--id, 0));
transform: translateZ(calc(var(--id, 0) * -1px));
transform-origin: 0 0;
animation: turn-page var(--duration) ease-in-out forwards;
--increment: calc(var(--duration) / (var(--pages) * 2));
animation-delay: calc( var(--id, 0) * var(--increment) + var(--initial-delay) * 2 );
}
main.page {
animation: none;
padding: 32px;
box-sizing: border-box;
overflow-y: scroll;
z-index: 1;
}
.cover {
width: 100%;
height: 100%;
color: var(--color-cover-text);
z-index: var(--pages);
padding: 5%;
box-sizing: border-box;
font-s.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0