Skip to content

Instantly share code, notes, and snippets.

@dougwollison
Created February 5, 2019 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougwollison/0e6e772bcb219ea3eade04eb039bddbc to your computer and use it in GitHub Desktop.
Save dougwollison/0e6e772bcb219ea3eade04eb039bddbc to your computer and use it in GitHub Desktop.
Transforming Menu Icon
@mixin menu-icon( $width, $height, $thickness ) {
$width: $width * 1px;
$height: $height * 1px;
$thickness: $thickness * 1px;
$margin: (($height - ($thickness * 3)) / 2);
$shift: $margin + $thickness;
.bar {
display: block;
width: $width;
margin: 0 auto;
border-bottom: $thickness solid;
transform-origin: center center;
transition: transform .2s, border .2s;
&.middle {
margin: $margin auto;
}
.nav-open & {
&.top {
transform: tranlateY($shift) rotate(45deg);
}
&.middle {
transform: scaleX(0);
}
&.bottom {
transform: translateY($shift * -1) rotate(-45deg);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment