پیشنمایش زنده
کد HTML
<button type="button" class="join-button">
<span class="fold"></span>
<div class="points_wrapper">
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
<i class="point"></i>
</div>
<span class="inner-btn">
<svg
class="icon"
fill="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10,21.236,6.755,14.745.264,11.5,6.755,8.255,10,1.764l3.245,6.491L19.736,11.5l-6.491,3.245ZM18,21l1.5,3L21,21l3-1.5L21,18l-1.5-3L18,18l-3,1.5ZM19.333,4.667,20.5,7l1.167-2.333L24,3.5,21.667,2.333,20.5,0,19.333,2.333,17,3.5Z"
></path>
</svg>
Hover me
</span>
</button>
کد CSS
/* Container styling */
.join-button {
--h-button: 44px;
--round: 0.75rem;
cursor: pointer;
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
overflow: hidden;
transition: all 0.25s ease;
background: radial-gradient(
65.28% 65.28% at 50% 100%,
rgba(11, 1, 14, 0.8) 0%,
rgba(223, 113, 255, 0) 100%
),
linear-gradient(0deg, #6f50ec, #491cff);
border-radius: var(--round);
border: none;
outline: none;
padding: 10px 20px;
height: var(--h-button);
}
/* Border effects */
.join-button::before,
.join-button::after {
content: "";
position: absolute;
inset: var(--space);
transition: all 0.5s ease-in-out;
border-radius: calc(var(--round) - var(--space));
z-index: 0;
}
.join-button::before {
--space: 1px;
background: linear-gradient(
177.95deg,
rgba(255, 255, 255, 0.19) 0%,
rgba(255, 255, 255, 0) 100%
);
}
.join-button::after {
--space: 2px;
background: radial-gradient(
65.28% 65.28% at 50% 100%,
rgba(5, 0, 7, 0.8) 0%,
rgba(223, 113, 255, 0) 100%
),
linear-gradient(0deg, #7a5af8, #401ec7);
}
.join-button:active {
transform: scale(0.95);
}
/* Folding corner effect */
.join-button .fold {
z-index: 1;
position: absolute;
top: 0;
right: 0;
height: 1rem;
width: 1rem;
display: inline-block;
transition: all 0.5s ease-in-out;
background: radial-gradient(
100% 75% at 55%,
rgba(29, 117, 218, 0.8) 0%,
rgba(223, 113, 255, 0) 100%
);
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
border-bottom-left-radius: 0.5rem;
border-top-right-radius: var(--round);
}
.join-button .fold::after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 150%;
height: 150%;
transform: rotate(45deg) translateX(0%) translateY(-18px);
background-color: #e8e8e8;
pointer-events: none;
}
.join-button:hover .fold {
margin-top: -1rem;
margin-right: -1rem;
}
/* Floating points animation */
.points_wrapper {
overflow: hidden;
width: 100%;
height: 100%;
pointer-events: none;
position: absolute;
z-index: 1;
}
.points_wrapper .point {
bottom: -10px;
position: absolute;
animation: floating-points-btn infinite ease-in-out;
pointer-events: none;
width: 2px;
height: 2px;
background-color: #fff;
border-radius: 9999px;
}
@keyframes floating-points-btn {
0% {
transform: translateY(0);
}
85% {
opacity: 0;
}
100% {
transform: translateY(-55px);
opacity: 0;
}
}
.points_wrapper .point:nth-child(1) {
left: 10%;
animation-duration: 2.35s;
animation-delay: 0.2s;
}
.points_wrapper .point:nth-child(2) {
left: 30%;
animation-duration: 2.5s;
animation-delay: 0.5s;
opacity: 0.7;
}
.points_wrapper .point:nth-child(3) {
left: 25%;
animation-duration: 2.2s;
animation-delay: 0.1s;
opacity: 0.8;
}
.points_wrapper .point:nth-child(4) {
left: 44%;
animation-duration: 2.05s;
opacity: 0.6;
}
.points_wrapper .point:nth-child(5) {
left: 50%;
animation-duration: 1.9s;
}
.points_wrapper .point:nth-child(6) {
left: 75%;
animation-duration: 1.5s;
animation-delay: 1.5s;
opacity: 0.5;
}
.points_wrapper .point:nth-child(7) {
left: 88%;
animation-duration: 2.2s;
animation-delay: 0.2s;
opacity: 0.9;
}
.points_wrapper .point:nth-child(8) {
left: 58%;
animation-duration: 2.25s;
animation-delay: 0.2s;
opacity: 0.8;
}
.points_wrapper .point:nth-child(9) {
left: 98%;
animation-duration: 2.6s;
animation-delay: 0.1s;
opacity: 0.6;
}
.points_wrapper .point:nth-child(10) {
left: 65%;
animation-duration: 2.5s;
animation-delay: 0.2s;
}
/* Inner content and icon */
.inner-btn {
z-index: 2;
gap: 8px;
position: relative;
width: 100%;
color: white;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 700;
line-height: 1.5;
font-family: "Inter", sans-serif;
}
.inner-btn svg.icon {
width: 18px;
height: 18px;
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.join-button:hover svg.icon {
transform: scale(1.3) rotate(15deg);
filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
}