xxxxxx <script><br> function shade(e, onComplete, distance, interval)<br> {<br> if (typeof e === "string")<br> {<br> e = document.getElementById(e);<br> } // 終了 if<br> distance = distance || 8;<br> 間隔 = 間隔 || 800;</p>
<p> varoriginalStyle = e.style.cssText;<br> e.style.position = "relative";<br> var start = (new Date()).getTime();</p>
<p> animate();</p>
<p> function animate()<br> {<br> var now = (new Date()).getTime();<br> var elapsed = now - start;<br> var progress = 経過 /間隔;<br> if (progress {<br> var y = 距離 * Math.sin(Math.PI * progress * 4);<br> var x = distance * Math.cos(Ma th.PI * 進捗状況* 4);<br> e.style.left = x "px";<br> e.style.top = y "px";<br> console.log(e.style.cssText);<br> setTimeout (animate, Math.min(25, elapsed));<br> } // end if<br> else<br> {<br> e.style.cssText =originalStyle;<br> if (onComplete)<br> {<br> onComplete(e);<br> } // end if</p>
<p> } // 終了 else</p>
<p> } // animate() を終了</p>
<p> } // シェイク終了()</p>
<p> </script>