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.
New-ish to Nodebox and trying to generate a random array of two colors. I've attached what I've come up with, but realize that there might (will) be more elegant answers to this. I've tried a few other routes, but haven't been able to make it work. And another thing with this is it doubles up geometry (i.e. when opened in illustrator, there's two of everything...)
Hi. I placed a divide node between your count node and repeat node to solve the duplicated geometry issu. I divided the quantity by two since what happened was that since every color counts as an element in the list, and you have two colors, you were getting twice the number of colors, and the number of ellypses would grow twofold to adapt to the number of elements in the color list.
I'm also new to NB3 and I wasn't able to figure out how to eliminate the color that would remain if your number of ellypses would be odd, as it actually is in your example. I had a few ideas but they were too complicated and think there must an easier solution for taking the decision to take an element out of the color list if it's size doesn't match the number of ellypses.
LU
LUlucasnijs
Hi Chris,
Your solution is OK (as is any solution that works). Concerning your problem with double geometry: you count the number of points in your grid (51) and you repeat this number twice by connecting it to the amount of colors in your colorlist (=2). If ypu look at your repeat list (double click it) you will see there are 102 colors listed. Your shuffle node will off course keep this amount and will have two values for every point on your grid, hence doubling the vectors. To solve: make a pick node, attach the repeated list as the list and the count of the grid as the number to be picked, et voila: 51 picked colors you can send to the colorize node.
best,
Lucas
LU
LUlucasnijs
Chris,
here is a solution that uses a subnetwork "circles". It is like a function that generates as many random red and black circles you need. It is getting fed by an amount of random numbers to change the seed of picking one of the colors, and by the points of the grid where you want the circles to appear. Have fun.