Reverse animation state

Hello! I’m trying to create this button animation with a wavy animation filling up the button on hover. I’d like that wavy animation to reverse when you stop hovering the button. Any idea on how to achieve that?

Thanks!