文字がパッと出てきて徐々に大きくなる、一定時間で消える、文字が消える時同じサイズでオラ!無駄!が出る
update: function () {
var mojiKouho = 'abcdefghijklnmopqrstuvwsyz';
var mondaiMoji = mojiKouho.charAt(Random.randint(0, mojiKouho.length - 1));
if (Math.randbool(4)) {
var mojiLabel = Label({
text: mondaiMoji,
fill: 'black',
fontSize: 30,
scaleX: 0.1,
scaleY: 0.1,
}).addChildTo(this)
.setPosition(Random.randint(+60, this.width - 60), Random.randint(100, this.height - 100));
var self = this;
mojiLabel.tweener
.scaleTo(3, 6500)
.call(function () {
mojiLabel.remove();
var index = self.mojiList.indexOf(mojiLabel);
if (index >= 0) {
self.mojiList.splice(index, 1);
}
self.changeTargetMoji();
});
this.mojiList.push(mojiLabel);
if (this.mojiList.length === 1) {
this.changeTargetMoji();
}
}
},
//中略
removeMoji: function (mojiLabel, effect, effectTime) {
var effectLabel = Label(effect)
.addChildTo(this)
.setPosition(mojiLabel.x, mojiLabel.y)
.setScale(mojiLabel.scaleX, mojiLabel.scaleY);
effectLabel.tweener
.wait(effectTime)
.call(function () {
effectLabel.remove();
});
mojiLabel.remove();
this.mojiList.shift();
this.changeTargetMoji();
}
.setPosition(Random.randint(+60, this.width - 60), Random.randint(100, this.height - 100));
x座標とy座標を指定範囲内でランダムな位置に生成
mojiLabel.tweener .scaleTo(3, 6500)
文字を6.5秒かけて標準の3倍表示にする
.setPosition(mojiLabel.x, mojiLabel.y)
.setScale(mojiLabel.scaleX, mojiLabel.scaleY);
オラ!無駄!を文字が消えた時と同じ位置、同じ表示倍率で表示する
effectLabel.tweener
.wait(effectTime)
.call(function () {
effectLabel.remove();
});
指定時間待った後、文字を消す