Consolidating duplicate animation code.