improved the keyboard animation calculation