html5 - 用css動畫方式描述:一個球彈起落下(持續時間2s,,執行一次)
問題描述
用css動畫方式描述:一個球彈起落下(持續時間2s,,執行一次)
問題解答
回答1:隨意寫的 沒有考慮兼容 可以自己更改一下運動速度什么的
<style>#app{ width: 300px; height:400px; border: 1px solid #d6e9c6; position: relative;}.barTip{ width: 100px; height: 10px; background: red; position: absolute; top: 130px; left: 32%;}#bar{ position: absolute; width: 30px; height:30px; background: #2a6496; border-radius: 15px; left: 45%; animation-name:myfirst; animation-duration:2s; animation-timing-function:linear; /*animation-delay:2s;*/ animation-iteration-count:1; animation-direction:alternate; animation-play-state:running;}@keyframes myfirst{ 0% { top:0px;} 10% { top:20px;} 20% { top:40px;} 30% { top:60px;} 40% { top:80px;} 50% { top:100px;} 60% { top:80px;} 70% { top:60px;} 80% { top:40px;} 90% { top:20px;} 100% { top:0px;}} </style></head><body><p id='app'> <p id='bar'><!--球--> </p> <!--板--> <p class='barTip'> </p></p回答2:
不知道你是不是要這樣,建議你還是看一下css3jsbin demo
相關文章:
1. linux - Ubuntu下編譯Vim8(+python)無數次編譯失敗2. java - 在搭建ssm的過程中 用junit測試Dao層 怎么樣都報錯 說連接不上jdbc3. javascript - 如何判斷用戶切換到了當前標簽頁?4. java - Mybatis關聯查詢5. css - 移動端 盒子內加overflow-y:scroll后 字體會變大6. java - 新手做一個安卓視頻播放器,想實現一個進度條,按鈕那種在視頻下方懸浮的功能,不知道思路!7. javascript - webpack 報錯 新人 求解8. javascript - H5頁面怎么查看console信息?9. nginx 80端口反向代理多個域名,怎樣隱藏端口的?10. 前端 - CSS3 box-shadow如何設置,或者用什么方法可以產生圖中這樣陰影的效果。
