add a timer function for animations