CSS3實(shí)現(xiàn)跳動(dòng)的動(dòng)畫效果
發(fā)布時(shí)間:2016-09-12 14:34:56 作者:佚名
我要評(píng)論

這篇文章給大家介紹了如何利用CSS3實(shí)現(xiàn)跳動(dòng)的動(dòng)畫效果,實(shí)現(xiàn)后的效果很好,有需要的朋友們可以參考學(xué)習(xí)。
靜態(tài)的效果圖如下:
這個(gè)要運(yùn)用的新知識(shí)如下:
復(fù)制代碼
代碼如下://css3新知識(shí)
display: flex;
justify-content: center;
align-items: center;
animation: shadow .5s linear infinite;
@keyframes shadow {
0%, 100% {transform: scaleX(1);}
50% {transform: scaleX(1.2);}
}
::after 需要加定位,寬度才好使
實(shí)例代碼如下
復(fù)制代碼
代碼如下:<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>無標(biāo)題文檔</title>
<style>
body{
background:#bbd149;
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.box{
height: 50px;
width: 50px;
position: relative;
}
.box::before{
content: '';
height: 8px; width: 50px; background: #000; opacity: .2; border-radius: 50%;
position: absolute;
top: 67px;
left: 0;
animation: shadow .5s linear infinite;
}
.box::after{
border-radius: 5px;
background: #fff;
animation: rotate .5s linear infinite;
content: '';
position: absolute;
left: 0;
top: 0;
width: 50px;
height: 50px;
}
@keyframes shadow {
0%, 100% {transform: scaleX(1);}
50% {transform: scaleX(1.2);}
}</p> <p>@keyframes rotate {
0% {
transform: translateY(0) rotate(0deg);
}
25% {
transform: translateY(10px) rotate(22.5deg);
}
50% {
transform: translateY(20px) scale(1.1, 0.9) rotate(45deg);
border-bottom-right-radius: 50px;
}
75% {
ransform: translateY(10px) rotate(67.5deg);
}
100% {
transform: translateY(0) rotate(90deg);
}
}
</style>
</head></p> <p><body>
<div class="box">
</div>
</body>
</html>
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作帶來一定的幫助,如果有疑問大家可以留言交流。
相關(guān)文章
CSS3 Calc實(shí)現(xiàn)滾動(dòng)條出現(xiàn)頁(yè)面不跳動(dòng)問題
calc是css3的一個(gè)新功能,用來指定元素的長(zhǎng)度,calc()最大的好處就是用在流體布局上,可以通過calc()計(jì)算得到元素的寬度。接下來腳本之家小編給大家分享CSS3 Calc實(shí)現(xiàn)滾動(dòng)2017-09-14HTML+CSS3模擬心的跳動(dòng)實(shí)例代碼
本文通過代碼給大家介紹了HTML+CSS3模擬心的跳動(dòng)的實(shí)現(xiàn)方法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧2017-09-05- 這篇文章主要介紹了CSS 3.0文字懸停跳動(dòng)特效代碼,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-10-26