首页 > 代码库 > 弹跳是不是自由落体?
弹跳是不是自由落体?
// 174 ? 175 : high; callback(high); }, delay); } window.onload = function () { a = document.getElementById("a"); XDancing(aLayout, 180); b = document.getElementById("b"); XDancing(bLayout, 120); c = document.getElementById("c"); XDancing(cLayout, 90); } // ]]>
C#
版
本
<html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <script type="text/javascript"> var a; var b; var c; var endtime = 6; var g = 4.9; function aLayout(_high) { a.style.top = _high + "px"; a.style.marginRight = 3 + "px"; a.style.marginLeft = 5 + "px"; } function bLayout(_high) { b.style.top = _high + "px"; b.style.marginRight = 3 + "px"; b.style.marginLeft = 5 + "px"; } function cLayout(_high) { c.style.top = _high + "px"; c.style.marginRight = 3 + "px"; c.style.marginLeft = 5 + "px"; } function XDancing(callback, delay) { var down = true; var high = 0; var downSpeed = 0; var DownOrUp = setInterval(function () { if (down) downSpeed++; if (!down) downSpeed--; if (downSpeed == endtime || downSpeed == 0) down = !down; high = Math.ceil(g * downSpeed * downSpeed); high = high > 174 ? 175 : high; callback(high); }, delay); } window.onload = function () { a = document.getElementById("a"); XDancing(aLayout, 180); b = document.getElementById("b"); XDancing(bLayout, 120); c = document.getElementById("c"); XDancing(cLayout, 90); } </script></head><body> <div style="border: 1px solid black; width: 120px; height: 195px;"> <div id="a" style="float: left; background-color: Green; position: relative;"> C# </div> <div id="b" style="float: left; background-color: Orange; position: relative;"> 版 </div> <div id="c" style="float: left; background-color: Blue; position: relative;"> 本 </div> </div></body></html>
弹跳是不是自由落体?
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。