پیشنمایش زنده
کد HTML
<div class="wrap">
<div class="button">
<div class="corner"></div>
<div class="inner">
<svg
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="#000000"
class="icon"
>
<path
d="M7 17L17 7L12 2V22L17 17L7 7"
stroke="#ffffff"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
></path>
</svg>
</div>
<span class="ripple"></span>
</div>
<div class="led"></div>
</div>
کد CSS
.wrap {
--radius: 30px;
--bg: #2c3238;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: relative;
}
.wrap::before {
content: "";
position: absolute;
width: 250px;
height: 3000px;
border-radius: 50px;
background-color: rgba(255, 255, 255, 0.05);
filter: blur(60px);
transform: skewY(-20deg);
pointer-events: none;
}
.wrap::after {
content: "";
position: absolute;
width: 100%;
height: 100%;
border-radius: 50px;
background-color: rgba(0, 0, 0, 0.5);
filter: blur(30px);
}
.button {
position: relative;
overflow: hidden;
width: 154px;
height: 150px;
background-color: var(--bg);
z-index: 2;
border: transparent;
border-radius: var(--radius);
box-shadow:
inset 0 1px 1px rgb(255 255 255 / 40%),
inset 0 -6px 1px -4px #0084ff,
inset 0 -15px 6px -8px #003cff;
transition: all 0.3s ease;
}
.button::before {
content: "";
position: absolute;
inset: 0;
border-radius: calc(var(--radius) * 0.8);
border-top: 50px solid #414244;
border-left: 40px solid #2b2b2c;
border-right: 40px solid #2b2b2c;
border-bottom: 50px solid #15161a;
filter: blur(6px);
transition: all 0.5s ease;
}
.button .corner {
transition: all 0.4s ease;
opacity: 0.1;
}
.button .corner::before,
.button .corner::after {
content: "";
position: absolute;
top: 0;
border-top: 55px solid white;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
filter: blur(6px);
}
.button .corner::before {
left: 8px;
transform: rotate(-40deg);
}
.button .corner::after {
right: 8px;
transform: rotate(40deg);
}
.button .inner {
z-index: 9;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
inset: 22px 20px;
border-radius: calc(var(--radius) * 0.85);
background: linear-gradient(180deg, #232324 5%, #46484b 100%);
transition: all 0.3s ease;
box-shadow:
inset 0 -5px 15px -1px rgba(0, 0, 0, 0.3),
inset 0 -4px 3px -3px black,
inset 0 -10px 20px -8px rgb(255 255 255 / 40%),
inset 0 1px 0 1px rgb(255 255 255 / 20%);
}
.button .inner svg {
display: block;
overflow: visible;
height: 45%;
}
.button .inner svg .symbol {
fill: #212123;
}
.button .inner svg .symbol-path {
filter: brightness(1.1) contrast(1.1);
}
.button .inner svg .symbol-path path {
stroke-dasharray: 650;
stroke-dashoffset: -650;
stroke-width: 5;
stroke: #3c69ff;
animation: symbolPath 2s ease-in-out;
}
.button .inner svg .symbol-path-glow path {
stroke-dasharray: 650;
stroke-dashoffset: -650;
stroke-width: 30;
stroke: #0231ce;
filter: blur(30px);
animation: symbolPath 2s ease-in-out;
}
.button .inner svg .symbol-path circle {
fill: #3c69ff;
opacity: 0;
animation: symbolCircle 2s ease-in-out;
}
.button .inner svg .symbol-path-glow circle {
fill: #0231ce;
filter: blur(30px);
opacity: 0;
animation: symbolCircle 2s ease-in-out;
}
.bg {
background-color: black;
position: absolute;
inset: -7px;
border-radius: calc(var(--radius) * 1.25);
box-shadow: 0 20px 10px -10px rgba(0, 0, 0, 0.3);
transition: all 0.3s ease;
overflow: hidden;
z-index: 1;
}
.bg::before {
content: "";
position: absolute;
border-radius: inherit;
box-shadow:
inset 0 -2px 0px -1px rgb(120 176 255 / 32%),
inset 0 0 5px 1px black,
inset 0 0 0 1px black;
inset: 0;
z-index: 1;
}
.bg .shine-1,
.bg .shine-2::before {
content: "";
position: absolute;
z-index: 0;
transition: all 0.3s ease;
background: rgba(0, 60, 255, 1);
width: 10px;
height: 10px;
left: 0;
right: 0;
bottom: 0;
margin: auto;
border-radius: 50%;
filter: blur(2px);
transform: translateY(0) scale(0);
animation: bg 2.4s linear 0.3s;
}
.bg .shine-2::before {
animation: bg 2.4s linear infinite;
}
.bg .shine-2 {
transition: all 0.5s linear;
opacity: 0;
}
.led {
position: absolute;
z-index: 10;
top: 100%;
border-radius: 50%;
width: 6px;
height: 6px;
margin-top: 22px;
transition: all 0.3s ease;
background-color: #3aeaf3;
box-shadow:
0 -10px 35px 17px #003cff,
inset 0 1px 2px 0px rgba(255, 255, 255, 0.6),
0 0 0px 3px rgb(0 0 0 / 60%),
0 0 2px 4px rgb(0 79 152 / 80%);
}
.wrap .button.active {
transform: scale(0.97);
filter: contrast(1.07);
background-color: transparent;
}
.wrap .button.active .inner {
background: linear-gradient(180deg, #232324 5%, #3b3d40 100%);
box-shadow:
inset 0 -5px 15px -1px rgba(0, 0, 0, 0.3),
inset 0 -4px 3px -3px black,
inset 0 -10px 20px -8px rgb(255 255 255 / 20%),
inset 0 1px 0 1px rgb(255 255 255 / 10%);
transform: scale(0.95);
}
.button:hover + .led {
box-shadow:
0 0 15px rgba(0, 0, 255, 0.9),
0 0 30px rgba(0, 0, 255, 0.7),
0 0 45px rgba(0, 0, 255, 0.5);
}
.button:hover .ripple {
animation: ripple-animation 0.6s ease-out infinite;
}
.ripple {
position: absolute;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.5);
border-radius: 50%;
opacity: 0;
transform: scale(0);
animation: ripple-animation 0.6s ease-out;
}
@keyframes ripple-animation {
0% {
transform: scale(0);
opacity: 0.8;
}
100% {
transform: scale(3);
opacity: 0;
}
}