css实现盒子组装成的小狗跳动动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现盒子组装成的小狗跳动动画效果代码

代码标签: css 盒子 小狗 跳动

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<style>

html,body {
    height: 100%;
    width: 100%;
    overflow: hidden
}

html {
    box-sizing: border-box
}

*,*:before,*:after {
    box-sizing: inherit
}

body {
    position: relative;
    background: #f0f0f0;
    padding: 0;
    margin: 0
}

.container {
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 600px;
    height: 420px
}

* {
    position: absolute
}

* *:before,* *:after {
    content: "";
    position: absolute
}

.box {
    background-color: #d1585d;
    width: 50%;
    height: 45%;
    left: 25%;
    bottom: 0;
    border-radius: 20px;
    transform-origin: center bottom;
    -webkit-animation: bigBox 8s linear infinite;
    animation: bigBox 8s linear infinite
}

.box:before {
    background-color: #f79568;
    width: 70%;
    height: 100%;
    bottom: 0;
    border-radius: 20px
}

.box:after {
    background-color: #ffbd31;
    height: 100%;
    width: 11%;
    right: 10%
}

.box .sign {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 3px solid #d1585d;
    left: 150px;
    top: 10%
}

.box .sign:after {
    width: 3px;
    height: 20px;
    left: 13px;
    top: 6px;
    background-color: #d1585d
}

.box .sign:before {
    width: 9px;
    height: 9px;
    left: 10px;
    top: 6px;
    border: 3px solid #d1585d;
    border-left: 0;
    border-bottom: 0;
    transform: rotate(-45deg)
}

.dog {
    bottom: 45%;
    height: 45%;
    width: 45%;
    -webkit-animation: dog-bounce 8s linear infinite;
    animation: dog-bounce 8s linear infinite;
    transform-origin: center bottom
}

.dog-group {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    -webkit-animation: dog-jump 8s linear infinite;
    animation: dog-jump 8s linear infinite;
    transform-origin: center bottom
}

.body-group {
    z-index: 2;
    width: 52%;
    height: 38%;
    bottom: 0;
    left: 25%
}

.body-group .dog-box {
    width: 100%;
    height: 100%;
    border-radius: 0 7px 7px;
    overflow: hidden;
    z-index: 3;
    background: #f79568;
    background: linear-gradient(90deg,#f79568 0,#f79568 67%,#d1585d 67%,#d1585d 100%)
}

.body-group .dog-box .dog-box-sign {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 3px solid #d1585d;
    left: 35%;
    top: 15%
}

.body-group .dog-box .dog-box-sign:after {
    width: 70%;
    height: 3px;
    border-radius: 10px;
    background-color: #d1585d;
    left: 15%;
    top: 5px;
    box-shadow: 0 6px #d1585d
}

.body-group .dog-box .dog-box-sign:before {
    width: 45%;
    height: 3px;
    border-radius: 10px;
    background-color: #d1585d;
    left: 39%;
    top: 17px
}

.body-group .dog-box .bottom-shadow {
    width: 100%;
    height: 20px;
    background-color: #a53942;
    bottom: -13px;
    transform: rotate(-2deg);
    -webkit-animation: shadows 8s linear infinite;
    animation: shadows 8s linear infinite
}

.body-group .dog-box .top-left-shadow {
    height: 40px;
    width: 60px;
    background-color: #a53942;
    transform: rotate(-15deg);
    top: -32px;
    left: -10px;
    -webkit-animation: shadows 8s linear infinite;
    animation: shadows 8s linear infinite
}

.body-group .dog-shape {
    border-radius: 50%;
    background-color: #39cede;
    width: 50px;
    height: 50px;
    right: 18%;
    top: -40%;
    z-index: 2;
    box-shadow: 6px 10px 0 #a53942;
    -webkit-animation: blue-shape 8s linear infinite;
    animation: blue-shape 8s linear infinite;
    transform-origin: center bottom
}

.body-group .tail-group {
    right: 0;
    top: -65%;
    height: 70px;
    width: 24px;
    z-index: 1;
    transform: rotate(25deg);
    -webkit-animation: tailGroup 8s linear infinite;
    animation: tailGroup 8s linear infinite;
    transform-origin: center
}

.body-group .tail-group .tail {
    bottom: 0;
    background-color: #ff4a50;
    height: 22px;
    width: 22px;
    border-radius: 0 0 20px 20px;
    z-index: 1;
    -webkit-animation: tail 8s linear infinite;
    animation: tail 8s linear infinite;
    transform-origin: center center
}

.body-group .tail-group .tail .tail {
    bottom: 40%
}

.body-group .tail-group .tail.last {
    border-radius: 20px
}

.head-group {
    bottom: 38%;
    width: 45%;
    height: 38%;
    left: 10%;
    -webkit-animation: dog-head 8s linear infinite;
    animation: dog-head 8s linear infinite;
    transform-origin: center bottom
}

.head-group .head {
    width: 100%;
    height: 100%;
    border-radius: 0 0 3px 3px;
    overflow: hidden;
    background: #f79568;
    background: linear-gradient(90deg,#f79568 0,#f79568 67%,#d1585d 67%,#d1585d 100%)
}

.head-group .head:after {
    background-color: #a53942;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    right: -25px;
    bottom: -25px
}

.head-group .ear {
    height: 30px;
    width: 50%;
    bottom: 100%;
    transform: perspective(3000px)
}

.head-group .ear.right {
    r.........完整代码请登录后点击上方下载按钮下载查看

网友评论0