TemperTony Posted September 8, 2017 Share Posted September 8, 2017 Hi there, I've been googling this for a while but all I've come up with is how to tint the sprite which isn't the result I want (I've tested, it colorizes the sprite) So I was wondering if it was possible to just fill the entire sprite with one solid color with no alpha channel? Thank you! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 8, 2017 Share Posted September 8, 2017 Use "PIXI.Texture.WHITE" and tint it. That's also how pixi works when you make Graphics with only one Rectangle. Quote Link to comment Share on other sites More sharing options...
TemperTony Posted September 8, 2017 Author Share Posted September 8, 2017 4 hours ago, ivan.popelyshev said: Use PIXI.Texture,WHITE + tint. I'm sorry, I'm a newb. Could you show me an example of PIXI.Texture.WHITE? Quote Link to comment Share on other sites More sharing options...
Exca Posted September 8, 2017 Share Posted September 8, 2017 Here you go: var sprite = new PIXI.Sprite(PIXI.Texture.WHITE); sprite.tint = 0xff0000; //Change with the color wanted sprite.width = 100; sprite.height = 100; maincontainer.addChild(sprite); Or if it's something that currently exists you could change the sprites .texture to PIXI.Texture.WHITE and tint it. [Edit]. If you need to have sprite change between normal display and completely tinted then just keep the normal texture stored somewhere and set it back to texture after tinting part is done. mircha and ivan.popelyshev 2 Quote Link to comment Share on other sites More sharing options...
TemperTony Posted September 8, 2017 Author Share Posted September 8, 2017 2 hours ago, Exca said: Here you go: var sprite = new PIXI.Sprite(PIXI.Texture.WHITE); sprite.tint = 0xff0000; //Change with the color wanted sprite.width = 100; sprite.height = 100; maincontainer.addChild(sprite); Or if it's something that currently exists you could change the sprites .texture to PIXI.Texture.WHITE and tint it. [Edit]. If you need to have sprite change between normal display and completely tinted then just keep the normal texture stored somewhere and set it back to texture after tinting part is done. Would setting something that already exists to PIXI.Texture.WHITE be done like this? sprite.texture = PIXI.Texture.WHITE Quote Link to comment Share on other sites More sharing options...
Exca Posted September 8, 2017 Share Posted September 8, 2017 Yep, that is the way. Quote Link to comment Share on other sites More sharing options...
KoolieTheKangaroo Posted February 26, 2019 Share Posted February 26, 2019 I know this is a rather old post, but when I try the solution, I get white squares where I expected the original texture shape painted solid white. // texture is the actual shaped and colored texture: this.sprite = new PIXI.Sprite(texture); this.sprite.texture = PIXI.Texture.WHITE; Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 26, 2019 Share Posted February 26, 2019 @KoolieTheKangaroo just use dark tint. https://github.com/gameofbombs/pixi-heaven mircha 1 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.