我正在研究createjs遊戲中的圖像被容納在容器內。我想將圖像補間到屏幕上的某個位置,並將圖像切換到另一張圖像。經過幾秒鐘後,我想從畫布/屏幕中刪除新圖像。CreateJS中的補間函數
目前,我將一個(evt)傳入函數,但其他遊戲/示例都不會打擾這部分?
它在第一個.call函數中工作,但在.wait和第二個.call之後我註釋掉的部分不起作用。突然,TheThingBeingTweened
是undefined
?
任何提示在正確的方向應該是有幫助的。
createjs.Tween
.get(inkContainer, {onChange: onInkContainerTweenChange})
.to({
y: playerContainer.y + (Math.random() * 200 - 100),
x: playerContainer.x + (Math.random() * 200)
}, 8000)
.call(function (evt) {
var theThingBeingTweened = evt.target;
//self.stage.removeChild(theThingBeingTweened);
var theContainer = theThingBeingTweened.parent;
theContainer.removeChild(theThingBeingTweened);
splatContainer = new createjs.Container();
splat = new
createjs.Bitmap(queue.getResult("splat"));
splatContainer.addChild(splat);
splatContainer.x = theThingBeingTweened.x;
splatContainer.y = theThingBeingTweened.y;
theContainer.addChild(splatContainer);
});
//.wait(3000)
//.call(function (evt) {
// var theThingBeingTweened = evt.target;
// self.stage.removeChild(theThingBeingTweened);
//});