CinkoNaap Posted February 24, 2014 Share Posted February 24, 2014 Hey,how can I center bitmap text at point? I tried : var worldLabel = new PIXI.BitmapText('World' + (i+1), {font: "35px Arial", align: "center"});worldLabel.x = ( ResolutionContants.TARGET_SIZE.x / 2 );but it gives me an effect of left-anchored text field. Is there any solution?Regards,Marcin Quote Link to comment Share on other sites More sharing options...
enpu Posted February 24, 2014 Share Posted February 24, 2014 // Center text at position 200, 200 var text = new PIXI.BitmapText('Hello', {font: 'Arial'}; text.position.x = 200 - text.textWidth / 2; text.position.y = 200 - text.textHeight / 2; skeddles 1 Quote Link to comment Share on other sites More sharing options...
CinkoNaap Posted February 24, 2014 Author Share Posted February 24, 2014 Oh cmn! Second time this have happened, i used width instead of textWidth.. Thanks!Anyway, you're faster than lightning :> Quote Link to comment Share on other sites More sharing options...
anissen Posted February 24, 2014 Share Posted February 24, 2014 I believe you can also usetext.anchor.set(0.5, 0.5);Which sets the anchor of the text sprite to be at the center of the sprite (i.e. 50% width, 50% height). Quote Link to comment Share on other sites More sharing options...
enpu Posted February 24, 2014 Share Posted February 24, 2014 Unfortunately there is no anchor in BitmapText Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.