css3动画展示

在这里插入图片描述demo.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css3动画展示</title>
    <link rel="stylesheet" href="demo.css">
</head>
<body>
    <div>
        <h2 class="monsterText">Hello
            <br>There
        </h2>
        <h3>We will eat you</h3>
    </div>
    <div class="monster">
        <div class="eye">
            <div class="eyeBall"></div>
        </div>
        <div class="mouth"></div>
    </div>
    <div class="monster blue">
        <div class="eye">
            <div class="eyeBall"></div>
        </div>
        <div class="mouth"></div>
    </div>
    <div class="pageLoading">
        <div class="monster">
            <div class="eye">
                <div class="eyeBall"></div>
            </div>
            <div class="mouth"></div>
        </div>
        <div class="loading">
            <div class="bar"></div>
        </div>
    </div>
    <script src="jquery-3.3.1.min.js"></script>
    <script src="demo.js"></script>
</body>
</html>

demo.css

*{
    padding: 0;
    margin: 0;
}
html,body{
    width: 100%;
    height: 100%;
    background-color: #db4d6d;
    display: flex;
    /* 水平居中 */
    justify-content: center;
    /* 垂直居中 */
    align-items: center;
}
.monster{
    position: relative;
    width: 110px;
    height: 100px;
    border-radius: 20px;
    background-color: #e55a54;
    margin: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .2);
    animation: jumping 0.8s infinite alternate;
}
.monster .eye{
    width: 40%;
    height: 40%;
    border-radius: 50%;
    background-color: #ffffff;
    margin: 10px;
    display: flex;
    /* 水平居中 */
    justify-content: center;
    /* 垂直居中 */
    align-items: center;
}
.monster .eye .eyeBall{
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background-color: #0c4475;
    animation: eyemove 1.6s infinite alternate;
}
.monster .mouth{
    width: 32%;
    height: 12px;
    border-radius: 12px;
    background-color: #ffffff;
}
.monster::before,.monster::after{
    position: absolute;
    content: "";
    display: block;
    width: 20%;
    height: 10px;
    border-radius: 10px;
    background-color: #ffffff;
    top: -10px;
    left: 50%;
}
.monster::before{
    transform: translateX(-70%) rotate(45deg);
}
.monster::after{
    transform: translateX(-30%) rotate(-45deg);
}
.monster.blue{
    animation-delay: 0.5s;
    background-color: #0c4475;
}
.monster.monster.blue .eyeBall,.monster.blue .mouth{
    background-color: #db4d6d;
}
@keyframes jumping{
    50%{
        top:0;
        box-shadow: 0 10px 20px rgba(0, 0, 0, .2);
    }
    100%{
        top: -50px;
        box-shadow: 0 120px 20px rgba(0, 0, 0, .1);
    }
}
@keyframes eyemove{
    0%,10%{
        transform: translateX(50%);
    }
    90%,100%{
        transform: translateX(-50%);
    }
}
.pageLoading{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0c4475;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.5s;
}

.pageLoading .loading{
    width: 200px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 5px;
    margin-top: 50px;
    overflow: hidden;
}
.pageLoading .loading .bar{
    width: 0%;
    height: 100%;
    background-color: #db4d6d;
}
.pageLoading.complete{
    opacity: 0;
}
.pageLoading.complete .monster{
    transition: 0.5s;
    transform: scale(0.1) rotateZ(360deg);
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值