Moiré patterns are caused by interference of two or more layers adjusted slightly out of sync.
When put together in a certain way, they create amazing looking optical illusions.
For example, this amazing optical illusion that looks like a hole in a field of stars.
Professor Tadashi Tokieda explains it best in this excellent Numberphile video.
A small shoutout to Numberphile, which hosts one of the best Youtube channels on Mathematics.
We can duplicate this exact experiment digitally instead of using transparencies.
The idea is exactly the same. First we create a layer of randomly generated dots, and create an exact layer stacked on top of it.
The below visualization allows you to manipulate the two layers.
I've added in extra features like having different colors for the two layers so that it is easier to see the different layers.
Rotate the layers by a small amount (between -5 to 5 degrees).
Like what is described by Professor Tadashi, if you exceed this, the visual effect gets harder to see.
Similarly, when you move the layers, small values (between -3 to 3) are best for seeing the visual effect.
You can exactly see Professor Tadashi's results by playing with the experiment yourself!