本篇內(nèi)容介紹了“純CSS3怎么打造好看的加載動畫效果”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
成都創(chuàng)新互聯(lián)主要從事網(wǎng)站建設(shè)、做網(wǎng)站、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)全南,十年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575
純css3打造的一款非常炫的加載圖。用在需要一定時間加載的地方非常合適。代碼非常簡單。沒有用任何javascript代碼。純css3實現(xiàn)。先上效果圖:
實現(xiàn)代碼如下:
html代碼:
XML/HTML Code復制內(nèi)容到剪貼板
<div class="content">
<div style="width: 970px; margin: auto">
</div>
<div class="rotate">
<span class="triangle base"></span><span class="triangle no1"></span><span class="triangle no2">
</span><span class="triangle no3"></span>
</div>
</div>
CSS代碼:
CSS Code復制內(nèi)容到剪貼板
body {
padding:0;
margin:0;
background-color: #2a4e66;
overflow: hidden;
}
.content {
width:100%;
height:100%;
top:0;
rightright:0;
bottombottom:0;
left:0;
position:absolute;
}
.rotate {
position: absolute;
top: 50%;
left: 50%;
margin: -93px 0 0 -93px;
background: transparent;
width: 186px;
height: 186px;
border-radius: 50%;
z-index: 20;
}
.rotate:after {
content: '';
position: absolute;
box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff;
width: 186px;
height: 186px;
border-radius: 50%;
z-index: 10;
}
span.triangle.base {
position: absolute;
width: 0;
height: 0;
margin: 46px 0 0 13px;
border-left: 80px solid transparent;
border-right: 80px solid transparent;
border-top: 140px solid #eeeeee;
transform-origin: 50% 50%;
z-index: 20;
}
span.triangle.no1 {
position: absolute;
margin: 46px 0 0 13px;
width: 0;
height: 0;
border-left: 80px solid transparent;
border-right: 80px solid transparent;
border-bottom: 140px solid #eeeeee;
transform-origin: 0 100%;
z-index: 20;
}
span.triangle.no2 {
position: absolute;
margin: 46px 0 0 13px;
width: 0;
height: 0;
border-left: 80px solid transparent;
border-right: 80px solid transparent;
border-bottom: 140px solid #eeeeee;
transform-origin: 100% 100%;
z-index: 20;
}
span.triangle.no3 {
position: absolute;
margin: 46px 0 0 13px;
width: 0;
height: 0;
border-left: 80px solid transparent;
border-right: 80px solid transparent;
border-bottom: 140px solid #eeeeee;
transform-origin: 50% 100%;
z-index: 20;
}
/* Animation */
.rotate {
-webkit-animation: rotateTriangle 3s linear infinite;
animation: rotateTriangle 3s linear infinite;
}
@-webkit-keyframes rotateTriangle {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(60deg); }
}
@keyframes rotateTriangle {
from { transform: rotate(0deg); }
to { transform: rotate(60deg); }
}
.rotate:after {
-webkit-animation: glowAnimation 3s ease infinite;
animation: glowAnimation 3s ease infinite;
}
@-webkit-keyframes glowAnimation {
0% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
10% { box-shadow: 0 0 80px #ffffff, 0 0 20px #ffffff, 0 0 2px #ffffff, inset 0 0 4px #ffffff, inset 0 0 8px #ffffff; }
100% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
}
@keyframes glowAnimation {
0% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
10% { box-shadow: 0 0 80px #ffffff, 0 0 20px #ffffff, 0 0 2px #ffffff, inset 0 0 4px #ffffff, inset 0 0 8px #ffffff; }
100% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
}
span.triangle.base {
-webkit-animation: scaleTriangleBase 3s linear infinite;
animation: scaleTriangleBase 3s linear infinite;
}
@-webkit-keyframes scaleTriangleBase {
from { -webkit-transform: translate(0px,-11px) scale(0.5); }
to { -webkit-transform: translate(0px,0px) scale(1); }
}
@keyframes scaleTriangleBase {
from { transform: translate(0px,-11px) scale(0.5); }
to { transform: translate(0px,0px) scale(1); }
}
span.triangle.no1 {
-webkit-animation: scaleTriangleOne 3s linear infinite;
animation: scaleTriangleOne 3s linear infinite;
}
@-webkit-keyframes scaleTriangleOne {
from { -webkit-transform: translate(0px,-46px) scale(0.5); }
to { -webkit-transform: translate(-80px,0px) scale(0); }
}
@keyframes scaleTriangleOne {
from { transform: translate(0px,-46px) scale(0.5); }
to { transform: translate(-80px,0px) scale(0); }
}
span.triangle.no2 {
-webkit-animation: scaleTriangleTwo 3s linear infinite;
animation: scaleTriangleTwo 3s linear infinite;
}
@-webkit-keyframes scaleTriangleTwo {
from { -webkit-transform: translate(0px,-46px) scale(0.5); }
to { -webkit-transform: translate(80px,0px) scale(0); }
}
@keyframes scaleTriangleTwo {
from { transform: translate(0px,-46px) scale(0.5); }
to { transform: translate(80px,0px) scale(0); }
}
span.triangle.no3 {
-webkit-animation: scaleTriangleThree 3s linear infinite;
animation: scaleTriangleThree 3s linear infinite;
}
@-webkit-keyframes scaleTriangleThree {
from { -webkit-transform: translate(0px,-116px) scale(0.5); }
to { -webkit-transform: translate(0px,-280px) scale(0); }
}
@keyframes scaleTriangleThree {
from { transform: translate(0px,-116px) scale(0.5); }
to { transform: translate(0px,-280px) scale(0); }
}
“純CSS3怎么打造好看的加載動畫效果”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!
網(wǎng)站標題:純CSS3怎么打造好看的加載動畫效果
文章URL:http://bm7419.com/article30/jcioso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、網(wǎng)站設(shè)計、定制開發(fā)、建站公司、網(wǎng)站建設(shè)、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)