MEJS
1
Hey what can i do this. What I’m doing wrong? In docs isn’t any example how to animte ex. Alpha:
https://photonstorm.github.io/phaser3-docs/Phaser.Types.Tweens.html#.TweenBuilderConfig
this.input.on("pointerdown", pointer => {
// this.matter.body.setAngularVelocity(this.player, 1000);
let flyUp = this.tweens.add({
targets: this.player,
scaleX: 2,
// alpha: { start: 0, to: 1 },
// alpha: 1,
// alpha: '+=1',
ease: "Linear", // 'Cubic', 'Elastic', 'Bounce', 'Back'
duration: 2000,
repeat: -1, // -1: infinity
yoyo: false
});
flyUp.play();
});
I guess there is no play
function of a tween and adding a tween starts the tween. So try deleting the play call.
Check this in phaser 3 examples
Villan
4
probably losing the scope… try adding callbackScope: this to the tweens arguments then you shouldn’t even need to call it to play
MEJS
5
I created a function where player is a parametr:
flyUpPlayer(player) {
player.setVelocityY(-5);
this.tweens.add({
targets: player,
angle: -20, // '+=100'
ease: "Linear", // 'Cubic', 'Elastic', 'Bounce', 'Back'
duration: 100,
repeat: 0,
yoyo: false
});
}