Jump to content

Replacing sprite with one solid color?


TemperTony
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • 1 year later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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