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

How to draw a line with a color gradient? #697

Open
bzm3r opened this issue Jan 8, 2021 · 2 comments
Open

How to draw a line with a color gradient? #697

bzm3r opened this issue Jan 8, 2021 · 2 comments

Comments

@bzm3r
Copy link

bzm3r commented Jan 8, 2021

We cannot pass a Gradient object to a points_colored, so how can we draw a line that has a color gradient according its path?

@lzurbriggen
Copy link

@bzm3r Maybe there's a better way and I haven't actually tried, but as a workaround you could try to render the gradient into a texture and use points_textured instead.

@zmitchell
Copy link

I think this is shown in the draw_polyline example. It doesn’t use Gradient specifically, but you can do it yourself. You have to manually apply the Gradient by setting the Gradient’s domain to the length of the line and using Gradient.get() for each vertex.

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

3 participants