animation
英 [??n??me??n]? ?美 [??n??me??n]??
n.生氣,活潑;動(dòng)畫片制作,動(dòng)畫片攝制;[影視]動(dòng)畫片
復(fù)數(shù): animations
direction
英 [d??rek?n]? ?美 [d??r?k??n, da?-]??
n.方向;趨勢;方面;用法說明
復(fù)數(shù): directions
css animation-direction屬性 語法
animation-direction屬性怎么用?
animation-direction屬性是用來定義是否應(yīng)該輪流反向播放動(dòng)畫的;當(dāng)動(dòng)畫播放次數(shù)超過一次時(shí),我們就可以通過設(shè)置animation-direction的值為alternate來實(shí)現(xiàn)動(dòng)畫輪流反向播放。
作用:定義是否應(yīng)該輪流反向播放動(dòng)畫。
語法:animation-direction: normal|alternate;
說明:normal ? ?默認(rèn)值。動(dòng)畫應(yīng)該正常播放。alternate ? ?動(dòng)畫應(yīng)該輪流反向播放。? ??
注釋:如果把動(dòng)畫設(shè)置為只播放一次,則該屬性沒有效果。
css animation-direction屬性 示例
<!DOCTYPE html> <html> <head> <style> div { width:100px; height:100px; background:red; position:relative; animation:myfirst 5s infinite; animation-direction:alternate; /* Safari and Chrome */ -webkit-animation:myfirst 5s infinite; -webkit-animation-direction:alternate; } @keyframes myfirst { 0% {background:red; left:0px; top:0px;} 25% {background:yellow; left:200px; top:0px;} 50% {background:blue; left:200px; top:200px;} 75% {background:green; left:0px; top:200px;} 100% {background:red; left:0px; top:0px;} } @-webkit-keyframes myfirst /* Safari and Chrome */ { 0% {background:red; left:0px; top:0px;} 25% {background:yellow; left:200px; top:0px;} 50% {background:blue; left:200px; top:200px;} 75% {background:green; left:0px; top:200px;} 100% {background:red; left:0px; top:0px;} } </style> </head> <body> <p><strong>注釋:</strong>Internet Explorer 9 以及更早的版本不支持 animation-direction 屬性。</p> <div></div> </body> </html>
運(yùn)行實(shí)例 ?
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例