I'll try my best to explain it. I started with
Leslie's visibility controller examples.
$visibility works on 0, making it not visibile; and not 0 (usually 1), which makes it visible.
(frame%$length) is a modulo operation which finds the remainder of division, so when $length is 24 is will always output 0 to 23. So just this would make it invisible on frame 0, 24, 48...
The offset is subtracted (because adding didn't work
) from the frame number to move which frame the action happens on.
The ! added on the front is a NOT, so that 0 becomes 1, and 1-23 become 0.
At this point, I wasn't sure if I could make it start at a particular frame number without an if statement. I looked at the scripting spec and found that the comparators return 0 or 1 based on truth.
(frame>=$startframe) gives 1 when the frame is greater then $startframe and 0 otherwise.
&& combines the two parts so that $visibility will be will be 1 when it is after the startframe and it is a frame it should be visible on.
I hope that's a good explanation, if I'm wrong, someone correct me.
Thanks for the tip on combining variable declarations.