前後に移動する単純な長方形のアニメーションを作成しました。問題は、スタート ボタンを 2 回押すと、動作がおかしくなることです。アニメーションを最初の位置から開始したい 開始を 2 回押した場合。
任意のヒント ?
function moveRect1()
{
// Reverse.uppfÖrande
if( xEnd == 150 )
xEnd = 50;
else
xEnd = 150;
// x heter x på rektanglar. Vänstra övre hörnet.
rect1.animate( {x: xEnd}, // det/de attribut som ska animeras, och till vilket värde.
1000, // tid
"Sine", // Ease funktion
function (){ moveRect1(); } //
); // end animation
}
アニメーションへのリンク