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.
Hi,
I'm wondering if there is any way to color a certain number of objects placed in a grid.
E.g. If I create a grid of 100 rectangles (10x10 grid) can I make it so 63 of them are one color and the rest stay black?
How would I go about doing this if possible?
Any help will be much appreciated thanks.
DN3
AN
ANandy.treichler
Dear DB3
I think "comparison example in math tutorial" could be the solution to your question.
Thanks so much guys. The slice node was the key I was missing. I had been looking for something with that functionality but somehow missed it.
LU
LUlucasnijs
Great solution from John again. Another way (there are many ways of doing this depending on your project goal), is to calculate the proportion of colors you need and then generate a list of colors to colorize the rectangles. It requires a few more nodes but the advantage is that if the proportion changes you do not have to change the numbers in two nodes, it is controlled by one number. Clever construction of your network allows for a network that can adapt to any number (or even any size of grid) that gets in. In particular handy for generative systems or data visualisation. The network in the sample I attach is not controlling if you go over 100 or under 0. The squares will be then all black in the former or all blue in the latter case. If a decimal number is put in the system automatically rounds the numbers, because the repeat node requires an integer.