apply css transitions to elements, calling back when the animation finishes