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. python - 數據與循環次數對應不上2. node.js - nodejs開發中常用的連接mysql的庫3. mysql - jdbc的問題4. python - 我在使用pip install -r requirements.txt下載時,為什么部分能下載,部分不能下載5. 視頻文件不能播放,怎么辦?6. python - 編碼問題求助7. windows7 ping不通虛擬機VMware上的linux(ubuntu)的ip8. 網頁爬蟲 - python 爬取網站 并解析非json內容9. mysql - 如何減少使用或者不用LEFT JOIN查詢?10. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處
