JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" class="btn">
<span class="btn-stage"></span>
<span class="btn-text">button</span>
</button>
CSS
body{
background: #212121
}
.btn{
position: fixed;
top: 50%;
left: 50%;
transform: translate3d(-50%,-50%,0);
border: 2px solid #616161;
width: 184px;
height: 40px;
border-radius: 50px;
background: #212121;
color: #EEEEEE;
overflow: hidden;
line-height: 36px;
outline: none;
cursor: pointer;
transition: all 1s ease;
}
.btn.charged{
border-color: #8BC34A;
box-shadow: 0 0 5px #000000, 0 0 50px 5px #8BC34A;
}
.btn-stage{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: left;
}
.btn-stage:after{
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
box-shadow: inset 0 0 1px 1px #000;
opacity: .4;
}
.btn-stage i{
display: inline-block;
width: 3.3333%;
height: 100%;
background: linear-gradient(to bottom, #a0da5c, #71a237 50%, #567d28 50%, #6f9e39 100%);
box-sizing: border-box;
box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.1), inset -1px 0 0 rgba(0, 0, 0, 0.2);
}
.btn-text{
z-index: 3;
text-shadow: 1px 1px #333;
display: block;
position: absolute;
top: 8px;
left: 0;
right: 0;
width: 60px;
margin: 0 auto;
background: rgba(33, 33, 33, 0.5);
line-height: 20px;
border-radius: 30px;
}
JavaScript
var $stage = document.querySelector('.btn-stage'),
i = 0;
document.querySelector('.btn').addEventListener('click', function(e){
e.preventDefault();
if(i < 30)
{
var bar = document.createElement('i');
$stage.appendChild(bar);
i++;
}
if(i == 30)
{
document.querySelector('.btn').classList.add('charged');
}
})