zoukankan      html  css  js  c++  java
  • 弹跳是不是自由落体?

    // 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;  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>
    View Code
  • 相关阅读:
    pcntl_fork 导致 MySQL server has gone away 解决方案
    视频网站 阻止迅雷劫持下载
    推荐大家使用的CSS书写规范、顺序
    console对象
    js Math函数
    致13级师弟师妹关于校招的一些话
    UVA514 铁轨 Rails:题解
    SP1805 HISTOGRA
    洛谷 P4363 [九省联考2018]一双木棋chess 题解
    比赛:大奔的方案solution
  • 原文地址:https://www.cnblogs.com/wjshan0808/p/3943943.html
Copyright © 2011-2022 走看看