The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.
i am trying to colorize circles in a grid with gradient based on three rgb colors - with those i have created a range of values.
but so far i have only managed to colorize a grid with a consistent number of points in each row. (eg. the amount of colors in the range is the same as the number of rows in the grid)
as i am generating (rasterized) shapes based on this grid, the number of points in the rows is not consistend anymore - and this workflow (of course) breaks.
what could be a possible approach?
the idea is to somehow either
a) limit the duplication of each color to the amount of points in the corresponding row.
b) color based on the y-position of each point
problems:
different shapes, with a different amount of rows are generated
i am not able to access the y-position key of an ellipse
any ideas?
JO
JOjohn
Tom,
To access the y-position of an ellipse (or any other path) just feed it into a centroid node to get its center point, and then feed that into a lookup node with the key set to y.
Once you have the y value for each dot, you can assign each row a color by using a slice node to slice one color from the list of colors forming your gradient.
You can use a convert_range node to convert the range of Y values to a sequence from 0 to the number of colors in your gradient. You can then feed that into the start parameter of a slice node to assign a color to each dot. Dots with the same Y value will get the same color.
In case that is not clear, I have attached a demo showing the basic technique (see screenshot and zipped file).
I create a collection of dots in the shape of a lower case a
I use the Y values of those dots and a convert_range node to find a sequence number within the gradient for each dot
I form the gradient by extending the 3 colors from your example into a color list using my palette node
Then I use a slice node to pick each sequence number from the gradient list and feed that into a colorize node
Hope that helps. Let me know if you have any more questions.