<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 一、實現動畫的方式 ![](http://cndpic.dodoke.com/6b4f4b64f757fde32d54aa1a9bd65352) 優先使用CSS3來實現動畫,在不支持CSS3時候, 動畫示例如下: ``` <button id="btn">start</button> <div id="box" class="box"></div> ``` ``` * { padding: 0; margin: 0; } .box { width: 100px; height: 100px; background-color: red; } ``` ``` .box { transition: transform 1s; } // 使用 CSS3 transition var boxEl = document.getElementById('box'), btnEl = document.getElementById('btn'); var dest = window.innerWidth - 100; btnEl.addEventListener('click', function () { move(boxEl, dest); }, false); function move(el, position) { el.style.transform = 'translate3d(' + position +'px, 0, 0)'; } ``` ``` // 或者使用 requestAnimationFrame var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function (fn) { setTimeout(fn, 16); }; var boxEl = document.getElementById('box'), btnEl = document.getElementById('btn'); var dest = window.innerWidth - 100, speed = 10, position = 0; btnEl.addEventListener('click', function () { requestAnimationFrame(step); }, false); function move(el, position) { el.style.transform = 'translate3d(' + position +'px, 0, 0)'; } function step() { if (position < dest) { position += speed; move(boxEl, position); requestAnimationFrame(step); } else { position = dest; move(boxEl, position); } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看