課程
/前端開發
/HTML/CSS
/十天精通CSS3
在9-9中設置both不應該是最后變為紅色嗎,執行的結果卻是藍色,不明白
2016-12-23
源自:十天精通CSS3 9-9
正在回答
backwards不是決定最終樣式的,它表示元素應用動畫時是否立即應用動畫的初始幀,forwards表示動畫執行完后停止在最后一幀的位置,最后一幀是什么樣式,結果就是什么樣式,明白?
小黍 提問者
@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
嗯,你這次描述的很正確??!
設置為both,包括設置了forwards和backwards,如果設置了forwards就會在動畫執行完后停止在最后一幀上,由于最后一幀是藍色,所以執行結果就是藍色。
VictorChan 回復 小黍 提問者
舉報
本課程為CSS3入門教程,深刻詳解CSS3知識讓網頁穿上絢麗裝備
3 回答animation-fill-mode當中 none和backward有啥區別?
1 回答animation-fill-mode這個屬性是干嘛的,為啥子我聽不懂啊
1 回答請問animation-name和animation區別
2 回答animation 與transition
1 回答animation的問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-12-27
backwards不是決定最終樣式的,它表示元素應用動畫時是否立即應用動畫的初始幀,forwards表示動畫執行完后停止在最后一幀的位置,最后一幀是什么樣式,結果就是什么樣式,明白?
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
嗯,你這次描述的很正確??!
2016-12-23
設置為both,包括設置了forwards和backwards,如果設置了forwards就會在動畫執行完后停止在最后一幀上,由于最后一幀是藍色,所以執行結果就是藍色。