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

color transformations #16

Open
anandology opened this issue Jul 16, 2021 · 1 comment
Open

color transformations #16

anandology opened this issue Jul 16, 2021 · 1 comment
Assignees

Comments

@anandology
Copy link
Contributor

Right now we can apply transformations on shapes, but there no way to generate patterns in color.

It would be nice to be able to specify a color range to repeat.

How about this?

c1 = color(r=255, g=0, b=0, a=0.5)
c2 = color(r=0, g=255, b=0, a=0.5)

ellipse() | repeat(36, rotate(10), fill=color_range(c1, c2), stroke="none")

This would apply colors from red to green to all the shapes.

The fill and stoke can also take a list of colors and it would cycle over the colors.

circle(x=100, y=0, r=25) | repeat(12, rotate(30), fill=['red', 'black'])

The same API could be applied to the combine function, which takes a list of shapes and converts into a single shape.

n = 6
d = 300/n
r = d/2
shapes = [circle(x=-150+r+i*d, y=0, r=r) for i in range(n)]
shape = combine(shapes, fill=['red', 'black'])
show(shape)

@amitkaps what do you think?

@vsrigayatri do you have any comments?

@anandology anandology self-assigned this Jul 16, 2021
@vsrigayatri
Copy link

vsrigayatri commented Jul 16, 2021 via email

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