I've seen a similar effect before. do you see if this is what you want?
codepen demo
Update:
body,
html,
div {
background: -sharp292a38;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
text-align: center;
}
svg {
width: 200px;
height: 150px;
cursor: pointer;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
path {
fill: none;
-webkit-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
-moz-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
-o-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
-ms-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
stroke-width: 40px;
stroke-linecap: round;
stroke: -sharpa06ba5;
stroke-dashoffset: 0px;
}
path-sharptop,
path-sharpbottom {
stroke-dasharray: 240px 950px;
}
path-sharpmiddle {
stroke-dasharray: 240px 240px;
}
.cross path-sharptop,
.cross path-sharpbottom {
stroke-dashoffset: -650px;
stroke-dashoffset: -650px;
}
.cross path-sharpmiddle {
stroke-dashoffset: -115px;
stroke-dasharray: 1px 220px;
}
codePen can view compiled CSS and JS:
Open the website-> f12-> Open response design mode-> Click this icon to observe class changes and corresponding css changes-> copy the corresponding code directly
implement
by changing
class. Hamburger-expanded
and
css transition
<div class="header-container">
<div class="header-hamburger">
<span></span>
<span></span>
<span></span>
</div>
<div>
.header-hamburger {
display: block;
width: 20px;
height: 15px;
line-height: 15px;
position: relative;
top: 14px;
right: 15px;
float: right;
margin: 0;
transform: rotate(0deg);
cursor: pointer;
}
.header-hamburger span {
display: block;
position: absolute;
height: 2.5px;
width: 100%;
background: rgb(38, 38, 38);
box-sizing: border-box;
border-radius: 1px;
opacity: 1;
left: 0;
transform: rotate(0deg);
transition: .25s ease-in-out;
transition-property: transform, opacity;
}
.header-hamburger span:nth-child(1) {
top: 0px;
transform-origin: left center;
}
.header-hamburger span:nth-child(2) {
top: 6px;
transform-origin: left center;
}
.header-hamburger span:nth-child(3) {
top: 12px;
transform-origin: left center;
}
.hamburger-expanded .header-hamburger span:nth-child(1) {
transform: rotate(45deg) translateY(-1.5px);
}
.hamburger-expanded .header-hamburger span:nth-child(2) {
transform: scaleX(0);
opacity: 0;
}
.hamburger-expanded .header-hamburger span:nth-child(3) {
transform: rotate(-45deg) translateY(1px);
}