Jesse Aldridge
Jesse Aldridge

Reputation: 8149

Why does my sprite disappear when I call shiftHSL?

If I uncomment the shiftHSL line below, the sprite does not appear.

<script src='https://rawgit.com/photonstorm/phaser/master/build/phaser.js'></script>

<script>
var game = new Phaser.Game(800, 400, Phaser.AUTO, '', {
  preload: function() { this.game.load.image('dwarf', 'res/dwarf.png') },
  create: function() {
    var bmd = game.make.bitmapData()
    bmd.width = 80
    bmd.height = 80
    bmd.circle(bmd.width / 2, bmd.width / 2, bmd.width / 2, '#ffffff')
    bmd.alphaMask('dwarf', bmd)
    // bmd.shiftHSL(0, -.5, 0)
    var sprite = game.add.sprite(100, 100, bmd)
  }
});
</script>

Upvotes: 1

Views: 289

Answers (1)

Jesse Aldridge
Jesse Aldridge

Reputation: 8149

Ok, I got it working. Looks like you need to call bmd.update() before calling shiftHSL.

Upvotes: 1

Related Questions