پیشنمایش زنده
کد HTML
<svg style="position: absolute; width: 0; height: 0;">
<filter id="unopaq" y="-100%" height="300%" x="-100%" width="300%">
<feColorMatrix
values="1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 9 0"
></feColorMatrix>
</filter>
<filter id="unopaq2" y="-100%" height="300%" x="-100%" width="300%">
<feColorMatrix
values="1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 3 0"
></feColorMatrix>
</filter>
<filter id="unopaq3" y="-100%" height="300%" x="-100%" width="300%">
<feColorMatrix
values="1 0 0 0.2 0
0 1 0 0.2 0
0 0 1 0.2 0
0 0 0 2 0"
></feColorMatrix>
</filter>
</svg>
<button class="real-button"></button>
<div class="backdrop"></div>
<div class="button-container">
<div class="spin spin-blur"></div>
<div class="spin spin-intense"></div>
<div class="backdrop"></div>
<div class="button-border">
<div class="spin spin-inside"></div>
<div class="button">Button</div>
</div>
</div>
کد CSS
.button-container {
position: relative;
margin: 0 2em;
}
.button-border {
padding: 3px;
inset: 0;
background: rgba(0, 0, 0, 0.333);
border-radius: inherit;
clip-path: path(
"M 90 0 C 121 0 126 5 126 33 C 126 61 121 66 90 66 L 33 66 C 5 66 0 61 0 33 C 0 5 5 0 33 0 Z"
);
}
.button {
justify-content: center;
align-items: center;
border: none;
border-radius: 0.875em;
clip-path: path(
"M 90 0 C 115 0 120 5 120 30 C 120 55 115 60 90 60 L 30 60 C 5 60 0 55 0 30 C 0 5 5 0 30 0 Z"
);
width: 120px;
height: 60px;
background: #111215;
display: flex;
flex-direction: column;
color: #fff;
overflow: hidden;
}
.real-button {
position: absolute;
width: 120px;
height: 60px;
z-index: 1;
outline: none;
border: none;
border-radius: 17px;
cursor: pointer;
opacity: 0;
}
.backdrop {
position: absolute;
inset: -9900%;
background: radial-gradient(
circle at 50% 50%,
#0000 0,
#0000 20%,
#111111aa 50%
);
background-size: 3px 3px;
z-index: -1;
}
.spin {
position: absolute;
inset: 0;
z-index: -2;
opacity: 0.5;
overflow: hidden;
transition: 0.3s;
}
.real-button:active ~ div .spin {
opacity: 1;
}
.spin-blur {
filter: blur(2em) url(#unopaq);
}
.spin-intense {
inset: -0.125em;
filter: blur(0.25em) url(#unopaq2);
border-radius: 0.75em;
}
.spin-inside {
inset: -2px;
border-radius: inherit;
filter: blur(2px) url(#unopaq3);
z-index: 0;
}
.spin::before {
content: "";
position: absolute;
inset: -150%;
animation:
speen 8s cubic-bezier(0.56, 0.15, 0.28, 0.86) infinite,
woah 4s infinite;
animation-play-state: paused;
}
.real-button:hover ~ div .spin::before {
animation-play-state: running;
}
.spin-blur::before {
background: linear-gradient(
90deg,
rgb(79, 255, 93) 30%,
#0000 50%,
rgb(57, 123, 255) 70%
);
}
.spin-intense::before {
background: linear-gradient(
90deg,
rgb(85, 255, 176) 20%,
#0000 45% 55%,
#59f 80%
);
}
.spin-inside::before {
background: linear-gradient(
90deg,
rgb(34, 231, 16) 30%,
#0000 45% 55%,
rgb(49, 255, 245) 70%
);
}
@keyframes speen {
0% {
rotate: 10deg;
}
50% {
rotate: 190deg;
}
to {
rotate: 370deg;
}
}
@keyframes woah {
0%. to {
scale: 1;
}
50% {
scale: 0.75;
}
}