calculate the delay for the frames