Animation overriding each other

Hello everyone! So I am working on a game in which if we press D the player will look to the right and press A will look back to his original place. The problem is that when I press A right after pressing D the camera will teleport forward and then come back to its original place. Is there a way I can make it so that the camera comes back from the place I pressed D and teleport forward? Thanks

Do you have a video? Hard to understand.