http://jiangshanmeta.github.io/demo/myWork/mobile/lottery/這是半成品的例子。我想做的是一個(gè)抽獎(jiǎng)盤。開始抽獎(jiǎng)后 給抽獎(jiǎng)盤添加轉(zhuǎn)動(dòng)動(dòng)畫并且把動(dòng)畫次數(shù)設(shè)為infinite(因?yàn)椴恢老蚝蠖苏?qǐng)求等待拿到結(jié)果需要多少時(shí)間)。我本來想后端返回結(jié)果后改變動(dòng)畫次數(shù)并且改變動(dòng)畫持續(xù)時(shí)間來實(shí)現(xiàn)減速,并且監(jiān)聽animationend事件通過transform+transition顯示最終抽獎(jiǎng)結(jié)果。但是減速過于突兀。目前一個(gè)方案是接收到后臺(tái)返回值之后,每轉(zhuǎn)一圈增加一點(diǎn)animation-duration。求教有沒有更好地解決方案。下面是關(guān)鍵幀@keyframes rotate { from { -webkit-transform: rotate(0deg); transform: rotate(0deg);
} to { -webkit-transform: rotate(360deg); transform: rotate(360deg);
}
}
如何用CSS3實(shí)現(xiàn)減速動(dòng)畫
慕虎7371278
2018-08-13 14:09:32