Changing handling of css animation