For a project I need to make a little animation showing what happens when you put two hexagonal lattices on top of each other and rotate one of them(Moiré pattern), and my advisor sugested using Mathematica, as I need this for other parts of the project. I wrote a simple code that does what I want, but it is very slow, and it is just crashing if I scale up the size of lattices/number of frames. Any suggestions on how to make this run more smoothly?
cell[x_, y_] := {Gray, Line[{{x, y}, {x, y + 2/3 Sin[120 Degree]}}],
Line[{{x, y}, {x + Cos[30 Degree]/2, y - Sin[30 Degree]/2}}],
Line[{{x, y}, {x - Cos[30 Degree]/2, y - Sin[30 Degree]/2}}], Red,
Disk[{x, y}, 0.1], Blue, Disk[{x, y + 2/3* Sin[120 Degree]}, 0.1]}
unitvecA = {Cos[120 Degree], Sin[120 Degree]}
unitvecB = {1, 0}
sheet = Table[cell @@ (unitvecA i + unitvecB j), {i, 1, 12}, {j, Ceiling[i/2], Ceiling[i/2] + 12}]
ListAnimate[Table[Graphics[{Rotate[sheet, x], sheet}], {x, 0, Pi, Pi/10}]]
Degree
might help a bit. $\endgroup$