updated elapse function

works with animation and slider via boolean parameter