Question about animation in menu buttons

Hello all,

I am currently designing my website and I have a question about something I can’t figure out. It has to do with animation on menu buttons.

Let’s say you’re on the main home page of a site. You press one of the menu buttons to take you elsewhere on the site, for example, the “about us” page.

After clicking, the “about us” page loads beginning with some kind of animation or tween. After you view the animation and the page itself, you decide to go elsewhere within the site such as “contact us”.

After clicking “contact us”, the animation on the “about” page plays again but in reverse before the “contact us” page loads.

I was wondering how I would achieve this?