Jump to content

Text Shadow Problem


i3Designer
 Share

Recommended Posts

I believe this is because pixi allocates a texture large enough to contain the text, but does not consider the shadow in that calculation. I guess it's an oversight that should be flagged on Github, though I think it may be a problematic one to fix, as the texture will have to be re-created when you add an effect which changes the size of the original, which without careful calculations will cause your text to 'jump' as the texture size changes.

Link to comment
Share on other sites

  • 10 months later...

Sorry about the post necro - but this is the top result for this issue, and I thought I'd share my solution:

 

var text = new Phaser.Text(game, 0, 0, text, {
  font: '22px Arial',
  fill: '#C81389',
  stroke: '#fff',
  strokeThickness: 4
});

 

text.padding.x = 10;
text.setShadow(3, 3, 'rgba(0,0,0,0.5)', 5);

 

Adding padding stops the shadow getting cropped

Link to comment
Share on other sites

  • 4 weeks later...

Sorry about the post necro - but this is the top result for this issue, and I thought I'd share my solution:

 

var text = new Phaser.Text(game, 0, 0, text, {

  font: '22px Arial',

  fill: '#C81389',

  stroke: '#fff',

  strokeThickness: 4

});

 

text.padding.x = 10;

text.setShadow(3, 3, 'rgba(0,0,0,0.5)', 5);

 

Adding padding stops the shadow getting cropped

 

 

It doesn't work for me (Phaser 2.4.2)

 

Anyone  found another solution for this?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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