mash, shuffle, python

Say you want to create the above animation of random spokes moving about; to do this you’ll need to shuffle the MASH points, read on to find out why, and how.

Let’s start with a grid distribution:

As you can see, when MASH creates a grid distribution, all the points are in an order (0, 1, 2, 3, 4 across the top here). I’ve used the Points node to visualise the numbers here.

If we add a Trails node to create some lines between a single point and say, 30 MASH points, it will connect to the first 30 points. See below.

This is obviously not what we’re after so we need to add a Python node to shuffle our MASH points and put them into a random order. This means that even though the first 30 points are connected, they’re all in a random order.

You can copy and paste the below into a Python node. It will shuffle all the points in any MASH network.

As you can see, our ids are now shuffled.

You can animate this by ’rounding’ the seed. In this example, every 10 frames we change the seed (it’s rounded up in 10s). I’ve commented out a version that will change the seed every 20 frames so you can see how it works.

So there are actually 2 MASH networks here. The first one just has a grid of little dots. The second one is more interesting; the Instancer is empty, but it has the same grid in the Distribute node as the first network. The second network is the one with the Python and Trails nodes.

The reason there are two different networks is because in the animation the Trails wander about but the grid stays still. So, on the network with the Trails on it, as you’ve probably guessed, I added a Signal node to make the trails animate about.

The finishing touch was adding an Offset node and using the Low Clamp and High Clamp settings to clip the point positions and keep them inside the grid. Before and after below:

On the left are the clamp settings.

On the right is how the MASH Editor looks when we’re finished (ignore the Id node!).