Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After using Graphic to draw graphics, you can directly use graphic.pluginname to change the color without redrawing. With SmoothGraphics, you can't change the color directly #26

Open
pcbren1987 opened this issue Sep 22, 2022 · 1 comment

Comments

@pcbren1987
Copy link

After using Graphic to draw graphics, you can directly use graphic.pluginname to change the color without redrawing.
With SmoothGraphics, you can't change the color directly

Here is an example:
The red rectangle can be changed to the green rectangle by directly changing pluginName, but this function is disabled after SmoothGraphics is used
https://codepen.io/pcbren1987/pen/MWGvNJP
image
image

@ivanpopelyshev
Copy link
Contributor

ivanpopelyshev commented Sep 22, 2022

Draw white and change graphics.tint, that's how it usually done.

Alternatively,

The red rectangle can be changed to the green rectangle by directly changing pluginName, but this function is disabled after SmoothGraphics is used

That's a shader switch. You can do a shader switch with SmoothGraphics, look at https://github.com/pixijs/graphics-smooth/blob/master/src/DashLineShader.ts , make your shader, add tint in uniforms, change it in "render" method.

If you want more advanced color replace , and maybe even color indexing/LUT, I can help with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants