Mix Node
Continuing the cavalcade of new nodes...
The mix node!
Mix is an alternative to the heavily used combine node. Combine takes up to 7 lists and spits out all of list 1, then all of list 2, etc.
Mix, in contrast, produces a mix across all the input lists. So it will spit out the first item of list 1, then the first item of list 2, etc. and will continue until all input lists are exhausted. If some of the lists have fewer items than others, it will, in the usual Nodebox way, start repeating those shorter lists until the longest list is exhausted.
Suppose, for example, you want create an alternating list of light and dark colors. You can feed one list of light colors into the mix node's list1 port, and another list of dark colors into its list2 port. If you input 3 of each kind, you will get light1, dark1, light2, dark2, light3, dark3.
If you only give it 2 dark colors, the dark list will start to repeat until you have pairs with all 3 light colors: light1, dark1, light2, dark2, light3, dark1.
The attached demo shows an example. I have four lists:
- 3 triangles in 3 colors
- 4 squares in 4 colors
- 5 pentagons in 5 colors
- 6 hexagons in 6 colors
On the left I feed them into a combine node and it outputs the four lists in order. On the right I feed them into a mix node and it mixes them together until there are six complete sets of four types. Once the triangles are used up, they start to repeat, and so on.
That's it! Enjoy!
-
Mix_Node_Screenshot.png 650 KB
- mix_node.ndbx.zip 34.7 KB
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac