【发布时间】:2017-08-17 15:16:41
【问题描述】:
我正在开发一个 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);
//});
【问题讨论】:
标签: javascript createjs tween