css3 - css做動(dòng)畫(huà)效果
問(wèn)題描述

把紅色框內(nèi)做成那種來(lái)回動(dòng)畫(huà)效果怎么做啊?
問(wèn)題解答
回答1:<!DOCTYPE html><html><head><style> p{ width:100px; height:100px; background:red; position:relative; animation:mymove 1s infinite; -moz-animation:mymove 1s infinite; /* Firefox */ -webkit-animation:mymove 1s infinite; /* Safari and Chrome */ -o-animation:mymove 1s infinite; /* Opera */ animation-direction: alternate;}@keyframes mymove{ from {left:0px;} to {left:200px;}}@-moz-keyframes mymove /* Firefox */{ from {left:0px;} to {left:200px;}}@-webkit-keyframes mymove /* Safari and Chrome */{ from {left:0px;} to {left:200px;}}@-o-keyframes mymove /* Opera */{ from {left:0px;} to {left:200px;}}</style></head><body><p></p></body></html>
運(yùn)行一下上面的代碼,改于w3school。
鏈接為:http://www.w3school.com.cn/cs...
回答2:給你個(gè)鏈接 自己對(duì)著改參數(shù)
回答3:給那個(gè)三角圖片 擺好位置后, 用類去控制動(dòng)作。
比如
.move { -webkit-animation-name:’example’; // other code} @-webkit-keyframes ’example’ { 0% {-webkit-transform: translateX(0); } 50% { -webkit-transform: translateX(100px); } 100% { -webkit-transform: translateX(0); } } // 補(bǔ)充說(shuō)明: -webkit-animation-name:’xxx’;/*動(dòng)畫(huà)屬性名,也就是我們前面keyframes定義的動(dòng)畫(huà)名*/ -webkit-animation-duration: 10s;/*動(dòng)畫(huà)持續(xù)時(shí)間*/ -webkit-animation-timing-function: ease-in-out; /*動(dòng)畫(huà)頻率,和transition-timing-function是一樣的*/ -webkit-animation-delay: 2s;/*動(dòng)畫(huà)延遲時(shí)間*/ -webkit-animation-iteration-count: 10;/*定義循環(huán)資料,infinite為無(wú)限次*/ -webkit-animation-direction: alternate;/*定義動(dòng)畫(huà)方式* 回答4:
css3的動(dòng)畫(huà)效果主要是通過(guò)過(guò)渡來(lái)實(shí)現(xiàn)的,用animate來(lái)定義一個(gè)補(bǔ)間動(dòng)畫(huà),瀏覽器會(huì)自動(dòng)根據(jù)設(shè)置的時(shí)間來(lái)進(jìn)行渲染。樓上兩位大神的代碼已經(jīng)做得很完善了,具體效果題主可以自己根據(jù)需要修改
相關(guān)文章:
1. 測(cè)試自動(dòng)化html元素選擇器元素ID或DataAttribute [關(guān)閉]2. html5 - datatables 加載不出來(lái)數(shù)據(jù)。3. javascript - QQ第三方登錄的問(wèn)題4. html5和Flash對(duì)抗是什么情況?5. 利用IPMI遠(yuǎn)程安裝centos報(bào)錯(cuò)!6. node.js - mongodb查找子對(duì)象的名稱為某個(gè)值的對(duì)象的方法7. 運(yùn)行python程序時(shí)出現(xiàn)“應(yīng)用程序發(fā)生異常”的內(nèi)存錯(cuò)誤?8. 在mac下出現(xiàn)了兩個(gè)docker環(huán)境9. 正在使用electron和node.js做桌面應(yīng)用,需要實(shí)時(shí)監(jiān)聽(tīng)是否有網(wǎng)絡(luò)連接,node或者electron是否可以做到10. spring-mvc - spring-session-redis HttpSessionListener失效

網(wǎng)公網(wǎng)安備