掃描二維碼的效果,我原以為不好寫呢,后來想了想其實挺簡單的,幾行代碼,走起
<div class="code-bg">
<div class="line"></div>
</div>
.code-bg{
position: relative;
height: 200px; width: 200px;
margin: 0px auto;/*此處為了居中*/
background: url(img/ewm1.jpg) center top no-repeat; /*二維碼*/
}
.line{
position: absolute;
left: -80px;
z-index: 2;
height: 3px; width: 360px;
background: url(img/share/dapai.png) no-repeat; /*上下掃的線*/
/*動畫效果*/
animation: myScan 1s infinite alternate;
-webkit-animation: myScan 1s infinite alternate;
}
@keyframes myScan{
from { top:0px; }
to { top: 197px; }
}
-webkit-@keyframes myScan{
from { top:0px; }
to { top: 197px; }
}
我這里不方便截圖,那就這樣吧,是不是很簡單。這樣就實現了
