Loading animation

Is there any way to add a loading spinning icon or something? I tried to use visibility and events but it doesn't seem to activate my image. Is there any efficient way to signal a function is being loaded? Dual%20Ring-1s-200px

Found a way, dumb async code.
Edit: For whoever is going to read this I will explain what I did wrong and how I managed to get it to work.
I was trying to do it like this:
But the true and false happened before the email was finished being sent so I needed to change to this:Screenshot%20from%202019-10-22%2015-14-05
A simple mistake on my side, if anyone knows a better way of doing this feel free to lecture me.