controlling the speed/rate with a shift register outs(kinda Larson scanner)

Is it a short code for if...then...else?

Yes. It controls the direction of flow for the leds based on the value of ctr.