How do I make a dynamic back button?

Let when you press on the play button, the starter ui moves left and level selection menu comes in the screen from right then you will need an animation player. If you want from pause menu to settings then you can just codes that pause_menu.hide(), settings.show(), if animation player then create the animation of the movement I have mentioned, so when player press on play button it will play the animation “menu-to-levels” and if he back to the menu then play backwards the same animation