Gagiopapinni Posted November 4, 2018 Share Posted November 4, 2018 What is the usage of tint on Graphics. As far as I can see tint can only be applied to Sprites. Quote Link to comment Share on other sites More sharing options...
Sahil Posted November 4, 2018 Share Posted November 4, 2018 Only reason I can think of is because you can have multiple shapes with different colors and fill in Graphics object so you can apply tint to entire graphics. Quote Link to comment Share on other sites More sharing options...
Gagiopapinni Posted November 4, 2018 Author Share Posted November 4, 2018 @Sahil This is from examples, I modified it. So we have here only one shape and only one color but tint is not working var renderer = PIXI.autoDetectRenderer(800, 600, { antialias: true }); document.body.appendChild(renderer.view); var stage = new PIXI.Container(); var graphics = new PIXI.Graphics(); graphics.beginFill(0xFF700B, 1); graphics.drawRect(50, 250, 120, 120); graphics.tint = 4*0xFFFFFF; stage.addChild(graphics); // run the render loop animate(); function animate() { renderer.render(stage); requestAnimationFrame( animate ); } Quote Link to comment Share on other sites More sharing options...
Sahil Posted November 4, 2018 Share Posted November 4, 2018 I think white tint doesn't really change anything, even on sprites. If you try different color, you will see tint gets applied. https://codepen.io/Sahil89/pen/gQbPwW?editors=1010 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 4, 2018 Share Posted November 4, 2018 What is "4 * 0xFFFFFF " ? Do you want it to somehow lighten the colors? Quote Link to comment Share on other sites More sharing options...
Gagiopapinni Posted November 5, 2018 Author Share Posted November 5, 2018 1 hour ago, ivan.popelyshev said: What is "4 * 0xFFFFFF " ? Do you want it to somehow lighten the colors? In fact, that's a meaningless thing which I wrote without thinking much. And it was the whole problem, the color must be in range of 000000 to ffffff , why would I try to get more than ffffff. My fault. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 5, 2018 Share Posted November 5, 2018 original color is multiplied by tint. If you want to change whole tint. If you want to use tint as color and change it every frame, its better to draw white shapes. 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.