courtneyvigo Posted December 9, 2016 Share Posted December 9, 2016 HI I am attempting to make the contents of the text object to, instead of the string that it allows, take information from an API. This is what I have so far: if (currentTextPosition == 0) { console.log(currentTextPosition); text1 = new PIXI.Text('UserName1', { fontFamily: 'Oswald', fontSize: 24, fill: 0xff1010, align: 'center' }); The string 'UserName1' would be replaced with API information is this possible? Quote Link to comment Share on other sites More sharing options...
Cold_Meson_06 Posted December 9, 2016 Share Posted December 9, 2016 You can update in your code the text of an PIXI.Text object after the creation. var srt = " New name " text1.text = srt All the properties of PIXI.Text can: text1.align = "center" text1.fill = 16715792 text1.fontFamily = "arial" text1.fontSize = 64 You can write an function to replace all these values with the new ones. Quote Link to comment Share on other sites More sharing options...
courtneyvigo Posted December 12, 2016 Author Share Posted December 12, 2016 Thank you! So if I was to add information via an API, it would give me a url with information and I can replace the " New name " with the API url? 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.