のためのアニメーションチェーンをクリア/キャンセル:ExtJSに4.2 - 私は、Webアプリケーションを構築することだし、ボタンがクリックされた場合、このアニメーションのチェーンが実行される部分がありますコンポーネント
var textReference = Ext.getCmp('splashText');
var checker = Ext.getCmp('arrow');
var img;
//for some reason, the logic is flipped
if(checker){
img = Ext.getCmp('arrow');
}
else{
console.log('checker is defined');
img = Ext.create('Ext.window.Window', {
header: false,
style: 'background-color: transparent; border-width: 0; padding: 0',
bodyStyle: 'background-color: transparent; background-image: url(graphics/arrow_1.png); background-size: 100% 100%;',
width: 70,
id: 'arrow',
height: 70,
border: false,
bodyBorder: false,
frame: false,
cls: 'noPanelBorder',
x: textReference.getBox().x - 90,
y: textReference.getBox().y - 10,
shadow: false,
});
}
img.show();
var origW = img.getBox().width,
origH = img.getBox().height,
origX = img.getBox().x,
origY = img.getBox().y;
//go down
Ext.create('Ext.fx.Anim', {
target: img,
duration: 500,
delay: 0,
from: {
x: textReference.getBox().x - 90,
y: textReference.getBox().y - 10,
},
to: {
y: origY + 180,
opacity: 1,
}
});
//bounce up 1st
Ext.create('Ext.fx.Anim', {
target: img,
duration: 500,
delay: 500,
from: {
},
to: {
y: origY + 50,
}
});
//fall down 1st
Ext.create('Ext.fx.Anim', {
target: img,
duration: 500,
delay: 1000,
from: {
},
to: {
y: origY + 180,
}
});
//bounce up 2nd
Ext.create('Ext.fx.Anim', {
target: img,
duration: 500,
delay: 1500,
from: {
},
to: {
y: origY + 100,
}
});
//fall down 2nd
Ext.create('Ext.fx.Anim', {
target: img,
duration: 500,
delay: 2000,
from: {
},
to: {
y: origY + 180,
}
});
//fade out
Ext.create('Ext.fx.Anim', {
target: img,
duration: 1000,
delay: 3500,
from: {
},
to: {
x: textReference.getBox().x - 90,
y: textReference.getBox().y - 10,
opacity: 0
}
});
それはちょうど基本ですアニメーションが「ボール」がドロップしてから上下にバウンスすると、ボウリングが2回上がってから下に落ちた後、フェードアウトするように見えます。
しかし、以前のアニメーションチェーンがまだアニメーション化されている間にユーザーがボタンを何度もクリックすると、アニメーションが合成され、ポジションの計算が複雑になり、ボールがはるかに低く見えるようになりますそれよりもすべきです。
これを防ぐには、ボタンをクリックするとアニメーションチェーン全体が最初にキャンセルされ、次にアニメーションが上から開始されます。これは、既存のアニメーションが停止してから新しいシーケンスが開始されるようにするためです。
誰でもこれを実行する方法について考えていますか?私はstopAnimation()
を試しましたが、何も起こりません。