climber Posted March 14, 2016 Share Posted March 14, 2016 Total pixi noob here. I'm loading in a texture from an image file and need to dynamically change its color. The image is basically a flat wave-like shape that I want to be able to make different colors dynamically. I tried tinting a sprite but that only tints and doesn't make the color 100% opaque. What's the proper way to do this? Some sort of filter? I figure the answer to this is really simple, but I've poked around the API and am not seeing it. Thanks for any help! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 15, 2016 Share Posted March 15, 2016 What mathematical operation do you want to apply to your texture RGBA? Quote Link to comment Share on other sites More sharing options...
climber Posted March 15, 2016 Author Share Posted March 15, 2016 It can be RGBA or a hex as long as it's solid, such as 0xff0000 or #ff0000. Quote Link to comment Share on other sites More sharing options...
fire7side Posted March 15, 2016 Share Posted March 15, 2016 What I do for tinting is use a white texture to start with. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
climber Posted March 15, 2016 Author Share Posted March 15, 2016 Thanks for the reply. Do you mean to have the wave image itself be white and then do what? Tint it? Quote Link to comment Share on other sites More sharing options...
fire7side Posted March 15, 2016 Share Posted March 15, 2016 Yeah. I don't know what the wave image is, but for mine, I use a white png image usually, and then set the tint to give it a color. I get the tint off of gimp color picker, but have to set the first two digits to 0x and then the 16 digit numbers, like 0xFFFFFF. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
climber Posted March 15, 2016 Author Share Posted March 15, 2016 Sweet, this totally works! I tried tinting before from a colored graphic which yielded weird results. Having a white base image works perfectly though. Really appreciate your help! Thank you. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 15, 2016 Share Posted March 15, 2016 @fire7side you rock @climber There are a number of ways of changing colors of picture, different shader and blendmodes (not all of blendmodes are possible in webgl). If you want to do something, first post how exactly do you think that thing must convert single pixel, then find the name of that effect 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.