当前位置:   article > 正文

弹跳是不是自由落体?

什么是非自由落体?

// 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>
View Code

 

转载于:https://www.cnblogs.com/wjshan0808/p/3943943.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/451440
推荐阅读
相关标签
  

闽ICP备14008679号