Help to understand what is going on

Found this site: LED Strip Effects generator

From clearly someone who can (unlike me) do C.

It creates this code:

I want to learn how it exactly works. I have some gaps in my knowlage (and don't have a clue how big those are).

cause my last code looked like this:

... and I kinda want make that more elegant ... like the first one.
Also less taxing and probably faster.