LED matrix control using arrays and state machine?

I hope you enjoyed the show!

I'm trying to wrap my head around how to add the functionality you showed to my sketch.

I've tried to insert it here with some naming changes of course.... Sure i'm doing something silly wrong.