2 回答

TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超7個(gè)贊
除了css3 和flash,請(qǐng)問(wèn)還有更好的方案嗎?js動(dòng)畫(huà),存在大量的CPU運(yùn)算和GPU,從運(yùn)算開(kāi)始,到每一幀的動(dòng)畫(huà)展示,這其中都有一個(gè)時(shí)間差,所以采用純js的方案,肯定是不行的。

TA貢獻(xiàn)1808條經(jīng)驗(yàn) 獲得超4個(gè)贊
試試這個(gè)@keyframes
例子如下,和他差不多吧
@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;}
????}
- 2 回答
- 0 關(guān)注
- 1900 瀏覽
添加回答
舉報(bào)