css布局实现小孩玩滑板动画效果代码
代码语言:html
所属分类:动画
代码描述:css布局实现小孩玩滑板动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
.wrapper {
position: absolute;
width: 150px;
height: 300px;
margin: auto;
top: calc(50% - 150px);
left: calc(50% - 50px);
}
.board {
position: absolute;
left: 15px;
bottom: 48px;
z-index: 10;
transform-style: preserve-3d;
-webkit-animation: board_movie 5s linear infinite;
animation: board_movie 5s linear infinite;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.board__body {
width: 100%;
height: 100%;
transform-style: preserve-3d;
}
.board__body--front {
z-index: 100;
transform: translateY(0);
-webkit-animation: board_front 5s linear infinite;
animation: board_front 5s linear infinite;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.board__body--front .board__center {
background: #525655;
}
.board__body--front .board__side {
background: #525655;
}
.board__body--back {
transform: translateY(1px);
-webkit-animation: board_back 5s linear infinite;
animation: board_back 5s linear infinite;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
z-index: 5;
}
.board__body--back .board__center {
background: #FFC038;
}
.board__body--back .board__side {
background: #FFC038;
}
.board__center {
position: absolute;
top: 0;
left: 0;
display: flex;
width: 150px;
height: 30px;
background: #525655;
overflow: hidden;
text-align: center;
transform-style: preserve-3d;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
justify-content: center;
transform: rotateX(-90deg);
}
.board__side {
position: absolute;
top: -25px;
left: 0;
width: 30px;
height: 40px;
display: flex;
overflow: hidden;
text-align: center;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
justify-content: center;
transform-origin: bottom;
}
.board__side--right {
border-radius: 50% 50% 0 0;
transform: rotateY(90deg) translateZ(135px) rotateX(-65deg);
}
.board__side--left {
border-radius: 50% 50% 0 0;
transform: rotateY(90deg) translateZ(-15px) rotateX(65deg);
}
.board__tires {
position: absolute;
top: 3px;
z-index: 1;
transform-style: preserve-3d;
}
.board__tire {
position: absolute;
top: 15px;
left: 0;
width: 20px;
height: 20px;
border-radius: 50%;
background: #59BBD0;
z-index: 5;
}
.board__tire:before {
position: absolute;
top: 0;
left: 0;
width: 20px;
height: 20px;
border-radius: 50%;
background: #59BBD0;
}
.board__tire span {
position: absolute;
top: 2px;
left: 1px;
width: 15px;
height: 15px;
border-left: 2px solid #D3D3D3;
border-right: 1px solid #D3D3D3;
border-radius: 50%;
-webkit-animation: tire_rotate 0.3s linear infinite;
animation: tire_rotate 0.3s linear infinite;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.board__tire span:before {
top: 6px;
right: 4px;
background: #525655;
width: 5px;
height: 5px;
border-radius: 90% 30%;
}
.board__tire:nth-of-type(1) {
transform: translateZ(-5px);
}
.board__tire:nth-of-type(2) {
transform: translateZ(10px);
}
.board__tire:nth-of-type(3) {
left: 120px;
transform: translateZ(-5px);
}
.board__tire:nth-of-type(4) {
left: 120px;
transform: translateZ(10px);
}
.human {
top: 0;
left: 0;
width: 120px;
height: 285px;
z-index: 1;
transform-style: preserve-3d;
transform: scale(0.8);
}
.human__head {
top: 0;
left: calc(100% - 120px / 2);
width: 50px;
height: 60px;
}
.human__face {
top: 17px;
left: 0px;
width: 50px;
height: 50px;
background: #e7c3aa;
border-radius: 50%;
z-index: 10;
transform-origin: bottom center;
-webkit-animation: jump_face 5s linear infinite;
animation: jump_face 5s linear infinite;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.human__face span {
position: absolute;
top: 34px;
left: 22px;
width: 17px;
transform: rotate(10deg);
}
.human__face span:before, .human__face span:after {
top: 0;
background: #2E2230;
width: 3px;
height: 3px;
}
.human__face span:before {
left: 0;
}
.human__face span:after {
right: 0;
}
.human__face:before {
top: -2px;
left: 6px;
width: 50px;
height: 32px;
background: #254f5f;
border-radius: 50% 50% 0 0;
transform: rotate(10deg);
}
.human__hood {
position: absolute;
top: 10px;
left: -5px;
}
.human__hood:before {
top: -28px;
left: -6px;
width: 49px;
height: 87px;
border-top: 31px solid #DC5551;
border-radius: 50%;
transform: rotate(-23deg);
}
.human__hood:after {
top: -5px;
left: 8px;
width: 70px;
height: 62px;
border-left: 23px solid #DC5551;
border-radius: 0 0 0 60%;
transform: rotate(36deg);
}
.human__hair {
position: absolute;
top: 34px;
right: 5px;
}
.human__hair > div {
border-radius: 50%;
}
.human__hair > div:before, .human__hair > div:after {
height: 44px;
border-top: 13px solid #3d2b37;
border-radius: 50%;
}
.human__hair > div:nth-of-type(1) {
top: -1px;
left: -10px;
width: 13px;
height: 46px;
border-top: 16px solid #3d2b37;
transform: rotate(19deg);
}
.human__hair > div:nth-of-type(1):before {
top: -9px;
left: 0px;
width: 12px;
transform: rotate(6deg);
}
.human__hair > div:nth-of-type(1):after {
top: -5px;
left: -3px;
width: 13px;
transform: rotate(10deg);
}
.human__hair > div:nth-of-type(2) {
top: -8px;
left: -46px;
width: 15px;
heigh.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0