Toggle icon on menu open/close

Is there a way to toggle the menu icon depending on the state of the menu?

I want to have a naviocn when the menu is closed and an ‘x’ when the menu is open. My plan is to run an SVG animation that will animate between the two menus, but failing that a simple switch of the icon.

If anybody can help I would really appreciate it.