btn animation
by Pranab Dey
HTML
<div class='container'>
<div class='layer'></div>
<button>Button</button>
</div>
SCSS
body {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
height: 100vh;
background: #07031d;
}
.layer {
position: relative;
z-index: 4;
&::before {
content: '';
background: rgba(#DBA217, 0.8);
filter: blur(10px);
width: 100%;
height: 90px;
border-radius: 50px;
position: absolute;
}
&::after {
content: 'Button';
width: 100%;
height: 90px;
border-radius: 50px;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
font-family: helvetica;
color: white;
font-weight: bold;
}
}
button {
border: 0;
width: 280px;
padding: 27px 0;
border-radius: 50px;
font-size: 30px;
color: transparent;
overflow: hidden;
position: relative;
z-index: 3;
box-shadow: inset 0px 0px 12px 2px #DBA217;
background: #efd28b;
&::after {
content: '';
width: 50px;
position: absolute;
height: 50px;
background: red;
z-index: 1;
filter: blur(10px);
right: 0;
top: 0;
border-radius: 50px;
box-shadow: 20px 10px 20px 40px #4CAF50, -20px -10px 20px 40px #a1175c;
animation: moveBefore 5s linear infinite;
}
&::before {
content: '';
width: 60px;
position: absolute;
height: 60px;
background: red;
z-index: 1;
filter: blur(10px);
box-shadow: 20px 15px 20px 40px #FFFF00, -20px -15px 20px 40px #c7362c;
left: 0;
top: 0;
border-radius: 50px;
animation: move 5s linear infinite;
}
}
@keyframes move {
0% {
top: 10%; left: 12%;
}
15% {
top: 20%; left: 20%;
transform: rotate(15deg);
}
25% {
top: 30%; left: 30%;
}
45% {
top: 40%; left: 60%;
transform: rotate(45deg);
background: #a1175c;
}
60% {
top: 30%; left: 90%;
}
70% {
top: 25%; left: 70%;
transform: rotate(35deg);
background: #2962FF;
}
80% {
top: 35%; left: 50%;
}
85% {
top: 15%; left:...