I'm using texture and textureAtlas in libgdx. This textures loads images of white circle.
How can I overlay its color with another color? Or maybe their is another approach for this?
private final static TextureAtlas textureAtlas = new TextureAtlas(Gdx.files.internal("spritesheet.atlas"));
private final static TextureAtlas.AtlasRegion texture = textureAtlas.findRegion("Bubble.001");
EDIT: As I said I have a white circle and I want to make it red (without the need for another image with a red circle)
You can use the lerp
method in Color class.
actor.setColor(Color.WHITE.cpy().lerp(tintingColor, .5f));
lerp
changes your Color
object, so use the cpy
command before it to preserve the original color. In this case I use WHITE as my original color, which preserves the color of your Actor
's texture. lerp
will overlay the tintingColor with a strength of 50% in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With