The current code will block anything else from running until the dimming loop has finished. That may be what you want, though.
Have a look at the Blockly reference here to see an example with a timer that uses a reschedule block to restart the timer over and over until a certain condition has been reached (see the doorbell example).