Noob question UI Animation

So, since I started to program in Unity 6 or 7 months ago, I always started a game and make a UIManager class, which have a list of game objects that represents each menu type.

Then, in the scene, I add the different menus: Main Menu, Config Menu, Sound Menu etc,
And add a button on those menus that , on click, will call the function :

UI_Menu_Manager.DisplayMenu("MainMenu");

This method sets all menus to gameobject.setActive(false), and will activate the gameobject passed by parameter.

This approach works nice but it doesn’t have “juice”, the menus simply appear and disappear, they doesn’t move at all (they doesn’t have animations).

On the other hand, this approach works nice, is simple, and doesn’t suffer from bugs like: clicking the button config and the sound config at two consecutive frames, while the main menu was moving, makes the animations to mess around, etc.

Are there any common/standard practice to make the menus play appear and disappear animations?

You can use a coroutine to set the alpha value

IEnumerator CanvasFadeIn()
        {
            //Here I'm using a canvas group on my canvas, and increasing the alpha value
            CanvasGroup cg = canvas.GetComponent<CanvasGroup>();
            cg.alpha = 0f;
            while (cg.alpha < 1f)
            {
                cg.alpha += .01f;
                yield return null;
            }
            cg.interactable = true;
        }

In addition, you can use a library like Dotween. I haven’t used it yet, but I’ve seen it being used for UI animations.