<div class="button">
<a>
<span class="text">Connect</span>
<span class="progress"></span>
<span class="icon"></span>
</a>
<span class="svg-button">
<span class="letter">c</span>
<span class="letter">o</span>
<span class="letter">n</span>
<span class="letter">n</span>
<span class="letter">e</span>
<span class="letter">c</span>
<span class="letter">t</span>
<span class="letter">e</span>
<span class="letter">d</span>
<svg width="190" height="55" viewBox="0 0 190 55" xmlns="http://www.w3.org/2000/svg">
<rect x='0' y='0' fill='none' width='190' height='55'/>
</svg>
</span>
</div>
<p class="source"><i class="fa fa-dribbble"></i> Rebound of <a target="_blank" href="https://dribbble.com/shots/1845328-Connect-Button">nimrodado</a> by <a target="_blank" href="https://dribbble.com/milanraring">me</a>.</p>
@import url(https://fonts.googleapis.com/css?family=Roboto:400,300);
$primary: #4193f7;
$success: #28e470;
$light: #e5e5e5;
body {
background: #fff;
font-family: 'Roboto', sans-serif;
font-size: 16px;
}
.source {
position: absolute;
left: 10px;
bottom: 10px;
margin: 0;
color: #999;
font-weight: 300;
font-size: 14px;
a {
color: #999;
text-decoration: none;
}
}
//--- ## BUTTON #############
.button {
width: 190px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
a {
width: 180px;
display: block;
text-align: center;
background: $primary;
border-radius: 4px;
padding: 5px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: .3s all ease-in-out;
.text {
display: block;
height: 45px;
line-height: 45px;
color: #fff;
transition: .3s all ease-in-out;
}
.progress {
background: $primary;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 0;
}
}
&.connect {
a {
background: $light;
width: 0;
padding: 5px 0;
float: right;
transition: .3s width ease-in-out 2.0s, .3s padding ease-in-out 2.0s;
.text {
animation: textHeight .6s ease-in-out forwards;
overflow: hidden;
}
.progress {
width: 100%;
transition: 1.4s width ease-out .6s;
}
}
}
&.connected {
a {
display: none;
}
}
.svg-button {
display: block;
visibility: hidden;
width: 180px;
height: 45px;
line-height: 45px;
padding: 5px;
text-align: center;
position: absolute;
border-radius: 4px;
overflow: hidden;
top: 0;
left: 0;
transform: translate(0%, -50%);
.letter {
opacity: 0;
color: $success;
display: inline-block;
transform: translate(0px, 5px);
}
svg {
position: absolute;
top: 0;
left: 0;
rect {
fill: none;
stroke: $success;
stroke-width: 2;
stroke-dasharray: 0, 480;
stroke-dashoffset: 480;
transition: all .3s ease-in-out;
}
}
}
&.connected {
.svg-button {
visibility: visible;
.letter {
animation: slideUp 0.3s cubic-bezier(0.645,0.045,0.355,1) forwards;
&:nth-child(1) {animation-delay: 0.05s;}
&:nth-child(2) {animation-delay: 0.1s;}
&:nth-child(3) {animation-delay: 0.15s;}
&:nth-child(4) {animation-delay: 0.2s;}
&:nth-child(5) {animation-delay: 0.25s;}
&:nth-child(6) {animation-delay: 0.3s;}
&:nth-child(7) {animation-delay: 0.35s;}
&:nth-child(8) {animation-delay: 0.4s;}
&:nth-child(9) {animation-delay: 0.45s;}
}
svg {
rect {
stroke-width: 6;
stroke-dasharray: 400, 0;
transition: all .3s ease-in-out;
}
}
}
}
}
@keyframes textHeight {
0% {height: 45px; line-height: 45px; opacity: 1}
25% {line-height: 35px;}
50% {height: 55px;}
75% {line-height: 75px;}
100% {height: 0; opacity: 0}
}
@keyframes progressbar {
0% {width: 0}
75% {width: 100%; left: 0}
100% {left: 190px}
}
@keyframes slideUp {
0% {opacity: 0; transform: translate(0px, 5px)}
100% {opacity: 1; transform: translate(0px,0px)}
}
View Compiled