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
  • 相关阅读:
    PHP一维数组转二维数组正则表达式
    PHP IDE选择标准
    PHP导出MySQL数据字典 Summer-Mysql-Dic
    PHP导入导出csv文件 Summer-CSV
    laravel学习
    php markdown 接口文档生成工具 SummerDoc
    AIX系统日志
    inotify+rsync实现实时同步
    shell数组应用
    Nginx缓存功能、防盗链、URL重写
  • 原文地址:https://www.cnblogs.com/wjshan0808/p/3943943.html
Copyright © 2011-2022 走看看