Jump to content

how to tween a mask


nak3ddogs
 Share

Recommended Posts

hi. i would mask smthing and move the mask. i have a solution, but do u know any better solution then it.

var numberTween = {step: 0};var shape = game.add.graphics();player.mask = shape;game.add.tween(numberTween).to({step:500}, 5000, Phaser.Easing.in, true, 0, 0, false);function update() {          game.shape.clear();          game.shape.beginFill(2, 0x0000f, 1);          game.shape.drawRect(0 , 0 + numberTween.step, game.world.width,game.world.height);}

thx for any advice

Link to comment
Share on other sites

and the perfect solution for me here

game.add.tween(numberTween).to({step:500}, 1000, Phaser.Easing.Quadratic.In, true, 0,  false).onUpdateCallback(function(){            game.shape.clear();            game.shape.beginFill(2, 0x0000f, 1);            game.shape.drawRect(0 , 0 + numberTween.step, game.world.width,game.world.height);            console.log(numberTween.step);          });
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...