Each frame is the previous frame index mapped to the Z-Curve permutation, the first one being the identity permutation (all colors in order). From 0 to 10 iterations, because the pattern repeats every 11 iterations.
An explanation of permutation index mapping for 5 items:
for A = [1, 3, 0, 4, 2]:
- A⁰ = [0, 1, 2, 3, 4] (indentity)
- A¹ = [1, 3, 0, 4, 2]
- A² = [3, 4, 1, 2, 0] = A×A
- A³ = [4, 2, 3, 0, 1] = A×A×A
- A⁴ = [2, 0, 4, 1, 3] = A×A×A×A
- A⁵ = [0, 1, 2, 3, 4] (repeats)
A³ = [A²[A[0]], A²[A[1]], A²[A[2]], A²[A[3]], A²[A[4]]], whereas A[n] is the nth item of A, first being 0.
An × Am = A(n+m)
The last frame is also equivalent to A-1, or the inverse of the Z-Curve map.
attempt 2