課程
/前端開發(fā)
/HTML/CSS
/十天精通CSS3
在9-9中設(shè)置both不應(yīng)該是最后變?yōu)榧t色嗎,執(zhí)行的結(jié)果卻是藍(lán)色,不明白
2016-12-23
源自:十天精通CSS3 9-9
正在回答
backwards不是決定最終樣式的,它表示元素應(yīng)用動畫時是否立即應(yīng)用動畫的初始幀,forwards表示動畫執(zhí)行完后停止在最后一幀的位置,最后一幀是什么樣式,結(jié)果就是什么樣式,明白?
小黍 提問者
@keyframes redToBlue{
? from{
? ? background: red;
? }
? 20%{
? ? ? background:green;
? 40%{
? ? ? background:lime;
? 60%{
? ? ? background:yellow;
? to{
? ? background:blue;
}
.div1 {
? width: 50px;
? height: 50px;
? background: orange;
? margin: 20px auto;
? animation-name:redToBlue;
? animation-duration: 5s;
? animation-timing-function: ease;
? animation-delay: 2s;
? animation-fill-mode: none;?
.div2 {
? animation-fill-mode: forwards;?
.div3 {
? animation-fill-mode: backwards;?
.div4 {
? animation-fill-mode: both;?
自己去感受 ?四個div 四個class
嗯,你這次描述的很正確?。?/p>
設(shè)置為both,包括設(shè)置了forwards和backwards,如果設(shè)置了forwards就會在動畫執(zhí)行完后停止在最后一幀上,由于最后一幀是藍(lán)色,所以執(zhí)行結(jié)果就是藍(lán)色。
VictorChan 回復(fù) 小黍 提問者
舉報
本課程為CSS3入門教程,深刻詳解CSS3知識讓網(wǎng)頁穿上絢麗裝備
3 回答animation-fill-mode當(dāng)中 none和backward有啥區(qū)別?
1 回答animation-fill-mode這個屬性是干嘛的,為啥子我聽不懂啊
2 回答animation 與transition
1 回答請問animation-name和animation區(qū)別
1 回答animation的問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-12-27
backwards不是決定最終樣式的,它表示元素應(yīng)用動畫時是否立即應(yīng)用動畫的初始幀,forwards表示動畫執(zhí)行完后停止在最后一幀的位置,最后一幀是什么樣式,結(jié)果就是什么樣式,明白?
2017-04-24
@keyframes redToBlue{
? from{
? ? background: red;
? }
? 20%{
? ? ? background:green;
? }
? 40%{
? ? ? background:lime;
? }
? 60%{
? ? ? background:yellow;
? }
? to{
? ? background:blue;
? }
}
.div1 {
? width: 50px;
? height: 50px;
? background: orange;
? margin: 20px auto;
? animation-name:redToBlue;
? animation-duration: 5s;
? animation-timing-function: ease;
? animation-delay: 2s;
? animation-fill-mode: none;?
}
.div2 {
? width: 50px;
? height: 50px;
? background: orange;
? margin: 20px auto;
? animation-name:redToBlue;
? animation-duration: 5s;
? animation-timing-function: ease;
? animation-delay: 2s;
? animation-fill-mode: forwards;?
}
.div3 {
? width: 50px;
? height: 50px;
? background: orange;
? margin: 20px auto;
? animation-name:redToBlue;
? animation-duration: 5s;
? animation-timing-function: ease;
? animation-delay: 2s;
? animation-fill-mode: backwards;?
}
.div4 {
? width: 50px;
? height: 50px;
? background: orange;
? margin: 20px auto;
? animation-name:redToBlue;
? animation-duration: 5s;
? animation-timing-function: ease;
? animation-delay: 2s;
? animation-fill-mode: both;?
}
自己去感受 ?四個div 四個class
2017-01-02
嗯,你這次描述的很正確?。?/p>
2016-12-23
設(shè)置為both,包括設(shè)置了forwards和backwards,如果設(shè)置了forwards就會在動畫執(zhí)行完后停止在最后一幀上,由于最后一幀是藍(lán)色,所以執(zhí)行結(jié)果就是藍(lán)色。