網(wǎng)上太多抄襲的demo,但是都沒有很好的效果掉弛,所以自己實(shí)現(xiàn)了一個(gè)症见,留給需要的人,話不多說 直接上代碼吧殃饿。
<!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" />
<title>css3動(dòng)畫圓波擴(kuò)散效果(紅色預(yù)警demo)</title>
<style>
@keyframes warn1 {
0% {
transform: scale(0.3);
-webkit-transform: scale(0.3);
opacity: 0.0;
}
25% {
transform: scale(0.3);
-webkit-transform: scale(0.3);
opacity: 0.1;
}
50% {
transform: scale(0.3);
-webkit-transform: scale(0.3);
opacity: 0.3;
}
75% {
transform: scale(0.5);
-webkit-transform: scale(0.5);
opacity: 0.5;
}
100% {
transform: scale(0.8);
-webkit-transform: scale(0.8);
opacity: 0.0;
}
}
.container {
position: relative;
width: 120px;
height: 120px;
margin: auto;
}
/* 產(chǎn)生動(dòng)畫(向外擴(kuò)散變大)的圓圈 第一個(gè)圓 */
.pulse {
position: absolute;
width: 300px;
height: 300px;
left: 0;
top: 0;
border: 1px solid #F56C6C;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
z-index: 1;
opacity: 0;
animation: warn1 2s linear 0.5s infinite;
box-shadow: 1px 1px 30px #F56C6C; /* 陰影效果 */
}
/* 產(chǎn)生動(dòng)畫(向外擴(kuò)散變大)的圓圈 第二個(gè)圓 */
.pulse1 {
position: absolute;
width: 300px;
height: 300px;
left: 0;
top: 0;
border: 1px solid #F56C6C;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
z-index: 1;
opacity: 0;
animation: warn1 2s linear 1s infinite;
box-shadow: 1px 1px 30px #F56C6C; /* 陰影效果 */
}
.pulse2 {
position: absolute;
width: 300px;
height: 300px;
left: 0;
top: 0;
border: 1px solid #F56C6C;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
z-index: 1;
opacity: 0;
animation: warn1 2s linear 1.5s infinite;
box-shadow: 1px 1px 30px #F56C6C; /* 陰影效果 */
}
.pulse3 {
position: absolute;
width: 300px;
height: 300px;
left: 0;
top: 0;
border: 1px solid #F56C6C;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
z-index: 1;
opacity: 0;
animation: warn1 2s linear 2s infinite;
box-shadow: 1px 1px 30px #F56C6C; /* 陰影效果 */
}
</style>
</head>
<body>
<div class="container">
<div class="pulse"></div>
<div class="pulse1"></div>
<div class="pulse2"></div>
<div class="pulse3"></div>
</div>
</body>
</html>
這個(gè)我是用在地圖紅色預(yù)警上的demo谋作,我把他抽出來了,希望能幫助到大家乎芳!