HTML5+CSS3小實(shí)例:冒泡loading動(dòng)畫

實(shí)例:冒泡loading動(dòng)畫
技術(shù)棧:HTML+CSS
效果:

源碼:
【html】

<!DOCTYPE html>
<html>
 
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
 
    <title>純CSS實(shí)現(xiàn)冒泡loading動(dòng)畫</title>
    <link rel="stylesheet" href="../css/95.css">
</head>
 
<body>
    <div class="loader">
        <div class="box">
            <div class="circle"></div>
            <div class="circle"></div>
        </div>
        <span>Loading...</span>
    </div>
</body>
 
</html>

【css】

*{
    /* 初始化 */
    margin: 0;
    padding: 0;
    /* box-sizing: border-box; */
}
body{
    /* 100%窗口高度 */
    height: 100vh;
    /* 彈性布局 水平+垂直居中 */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #333;
}
.loader{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.loader .box{
    /* 相對定位 */
    position: relative;
    width: 200px;
    height: 200px;
    /* 執(zhí)行動(dòng)畫:動(dòng)畫名 時(shí)長 線性的 無限次播放 */
    animation: rotateBox 10s linear infinite;
}
.loader .box .circle{
    /* 絕對定位 */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F5E866;
    border-radius: 50%;
    /* 執(zhí)行動(dòng)畫:動(dòng)畫名 時(shí)長 線性的 無限次播放 */
    animation: animate 5s linear infinite;
}
.loader .box .circle:nth-child(2){
    background-color: #A08FD5;
    /* 設(shè)置第二個(gè)圓的動(dòng)畫延遲時(shí)間 */
    animation-delay: -2.5s;
}
.loader span{
    margin-top: 30px;
    font-size: 20px;
    font-weight: 400;
    color: #fff;
    letter-spacing: 4px;
}
 
/* 定義動(dòng)畫 */
@keyframes animate {
    0%{
        transform: scale(1);
        transform-origin: left;
    }
    50%{
        transform: scale(0);
        transform-origin: left;
    }
    50.01%{
        transform: scale(0);
        transform-origin: right;
    }
    100%{
        transform: scale(1);
        transform-origin: right;
    }
}
@keyframes rotateBox {
    to{
        transform: rotate(360deg);
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容