پیشنمایش زنده
کد HTML
<div class="play-button-container">
<button class="play-button">
<span class="button-text">Play</span>
<div class="clip"></div>
<div class="triangle-arrow"></div>
<div class="corner top-left"></div>
<div class="corner top-right"></div>
<div class="corner bottom-left"></div>
<div class="corner bottom-right"></div>
</button>
</div>
کد CSS
.play-button-container * {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.play-button-container body {
background-color: #111;
font-family: "Russo One", sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.play-button-container {
position: relative;
}
.play-button-container .play-button {
position: relative;
padding: 1.2em 3em;
border: none;
outline: none;
background-color: transparent;
color: #ff0;
font-size: 20px;
font-weight: bold;
letter-spacing: 2px;
text-transform: uppercase;
cursor: pointer;
transition: 0.3s ease;
z-index: 2;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.play-button-container .play-button:hover {
background-color: #ff004d;
transform: scale(1.05);
}
.play-button-container .play-button:active {
transform: scale(0.95);
background-color: #003366;
box-shadow:
0 0 10px #003366,
0 0 20px #003366,
0 0 30px #003366;
}
.play-button-container .button-text {
position: relative;
z-index: 3;
}
.play-button-container .clip {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 5px solid #ff004d;
clip-path: polygon(
20% 0%,
80% 0%,
100% 30%,
100% 70%,
80% 100%,
20% 100%,
0% 70%,
0% 30%
);
box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
transition: 0.3s ease;
animation: shape-glitch 1.5s infinite ease-in-out;
}
.play-button-container .play-button:hover .clip {
box-shadow: inset 0 0 25px #ff0066;
}
.play-button-container .corner {
position: absolute;
width: 30px;
height: 30px;
background-color: #ff004d;
transform: rotate(45deg);
box-shadow: inset 1px 1px 8px #ff0066;
transition: 0.2s ease;
animation: corner-glitch 2s infinite ease-in-out;
}
.play-button-container .top-left {
top: -15px;
left: -15px;
}
.play-button-container .top-right {
top: -15px;
right: -15px;
}
.play-button-container .bottom-left {
bottom: -15px;
left: -15px;
}
.play-button-container .bottom-right {
bottom: -15px;
right: -15px;
}
.play-button-container .play-button:hover .corner {
transform: scale(1.25) rotate(45deg);
background-color: #ff0066;
animation: corner-light 0.4s ease-in-out infinite alternate;
}
@keyframes glitch {
0% {
transform: translateX(0px) translateY(0px);
opacity: 1;
}
25% {
transform: translateX(1px) translateY(1px);
opacity: 0.9;
}
50% {
transform: translateX(-1px) translateY(-1px);
opacity: 0.8;
}
75% {
transform: translateX(1px) translateY(1px);
opacity: 0.9;
}
100% {
transform: translateX(0px) translateY(0px);
opacity: 1;
}
}
@keyframes shape-glitch {
0% {
clip-path: polygon(
20% 0%,
80% 0%,
100% 30%,
100% 70%,
80% 100%,
20% 100%,
0% 70%,
0% 30%
);
box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
}
25% {
clip-path: polygon(
15% 0%,
85% 0%,
100% 35%,
100% 65%,
85% 100%,
15% 100%,
0% 65%,
0% 35%
);
box-shadow: inset 0 0 25px #ff0066;
}
50% {
clip-path: polygon(
10% 0%,
90% 0%,
100% 40%,
100% 60%,
90% 100%,
10% 100%,
0% 60%,
0% 40%
);
box-shadow: inset 0 0 20px #ff0066;
}
75% {
clip-path: polygon(
20% 0%,
80% 0%,
100% 30%,
100% 70%,
80% 100%,
20% 100%,
0% 70%,
0% 30%
);
box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
}
100% {
clip-path: polygon(
20% 0%,
80% 0%,
100% 30%,
100% 70%,
80% 100%,
20% 100%,
0% 70%,
0% 30%
);
box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
}
}
@keyframes corner-glitch {
0% {
transform: scale(1) rotate(45deg);
opacity: 1;
}
25% {
transform: scale(1.1) rotate(50deg);
opacity: 0.9;
}
50% {
transform: scale(0.9) rotate(40deg);
opacity: 0.8;
}
75% {
transform: scale(1.1) rotate(50deg);
opacity: 0.9;
}
100% {
transform: scale(1) rotate(45deg);
opacity: 1;
}
}
@keyframes corner-light {
0% {
box-shadow: inset 0 0 5px #ff0066;
}
100% {
box-shadow: inset 0 0 15px #ff0066;
}
}