Here is a simple hamburger menu icon to a close animation designed by Dicson. When you click on it the hamburger menu collapses to a single line and then transforms into an X mark.
If you are having trouble with the pen, try the archived copy on GitHub
Hamburger Menu to X Snippet
See the Pen Menu Button by Dicson (@dicson) on CodePen.0