Functional animation in icons

We are all probably familiar with the use of animation in very specific scenarios when it comes to display of system states such as the loading animation.

However, the recent trend of animation in icons (in particular pure CSS types) has introduced a new level of interaction with end users.

I am interested to know if these icons are designed to be aesthetically pleasing (and focusing on the general user experience) or if people have seen good examples of functional animations applied to icons that have a specific feature that assists with usability or ease-of-use or accessibility?

Some examples of animation in buttons: https://www.w3schools.com/howto/howto_css_loading_buttons.asp