h1 Liquid Button
span made by YU EN
.wrap
.span.span-1
.span.span-2
.span.span-3
.span.span-4
.symbol ⋮
p Background
.wrap-2
.span.span-1
.span.span-2
.span.span-3
.span.span-4
.symbol ⋮
p Outline
View Compiled
body {
margin: 0;
padding: 0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
height: 100vh;
background: #FFE8D5;
font-family: 'Catamaran', sans-serif;
font-family: 'Ubuntu', sans-serif;
font-family: 'Libre Baskerville', serif;
letter-spacing: .5px;
}
h1 {
width: 100%;
text-align: center;
font-size: 20px;
color: #FFAA63;
margin-top: 1.5rem;
position: absolute;
top: 50%;
span {
display: block;
font-size: 12px;
opacity: .6;
margin-top: .7rem;
font-family: 'Catamaran', sans-serif;
}
}
p {
width: 100%;
text-align: center;
font-size: 16px;
color: #FF9D4C;
margin-top: 1.5rem;
position: absolute;
top: 90px;
opacity: .5;
transition: all 300ms;
font-family: 'Ubuntu', sans-serif;
font-weight: 500;
}
$w: 130px;
.wrap, .wrap-2 {
margin: 0 3rem;
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 35%;
&:hover {
p {
opacity: 1;
}
}
.span {
cursor: pointer;
border: 1.5px solid white;
width: $w;
height: $w;
position: absolute;
opacity: .6;
border-radius: 100%;
transition: all;
}
}
.wrap {
.symbol {
color: #FFD3AE;
font-size: 36px;
z-index: 1;
transition: all 1000ms;
user-select: none;
cursor: pointer;
&.go-heart {
transition: all 1000ms;
animation: go-heart 1000ms infinite linear;
}
}
.span {
cursor: pointer;
border: 1.5px solid white;
position: absolute;
background: white;
opacity: .6;
border-radius: 100%;
transition: all;
}
.span-1 {
transition: all 1200ms;
&.go {
border-radius: 40% 42% 45% 55%;
animation: gogo 5200ms infinite linear;
}
}
.span-2 {
transition: all 1200ms;
&.go {
border-radius: 55% 41% 65% 43%;
animation: gogo-2 5500ms infinite linear;
}
}
.span-3 {
transition: all 1200ms;
&.go {
border-radius: 52% 72% 45% 61%;
animation: gogo 3400ms infinite linear;
}
}
.span-4 {
transition: all 1200ms;
&.go {
border-radius: 58% 56% 72% 58%;
animation: gogo-2 6000ms infinite linear;
}
}
}
.wrap-2 {
.symbol {
color: white;
font-size: 36px;
z-index: 1;
transition: all 1000ms;
user-select: none;
cursor: pointer;
&.go-heart {
transition: all 1000ms;
animation: go-heart 1000ms infinite linear;
}
}
.span-1 {
transition: all 1200ms;
&.go {
border-radius: 40% 42% 45% 55%;
animation: gogo 5200ms infinite linear;
}
}
.span-2 {
transition: all 1200ms;
&.go {
border-radius: 55% 41% 65% 43%;
animation: gogo-2 5500ms infinite linear;
}
}
.span-3 {
transition: all 1200ms;
&.go {
border-radius: 52% 72% 45% 61%;
animation: gogo 3400ms infinite linear;
}
}
.span-4 {
transition: all 1200ms;
&.go {
border-radius: 58% 56% 72% 58%;
animation: gogo-2 6000ms infinite linear;
}
}
}
.go {
transition: all 1200ms;
}
@keyframes gogo {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes gogo-2 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-720deg);
}
}
@keyframes go-heart {
from {
transform: scale(1.3) rotate(0deg);
} to {
transform: scale(1.3) rotate(360deg);
}
}
View Compiled
$('.wrap').on('click', function(){
$('.wrap .span-1').toggleClass('go');
$('.wrap .span-2').toggleClass('go');
$('.wrap .span-3').toggleClass('go');
$('.wrap .span-4').toggleClass('go');
$('.wrap .symbol').toggleClass('go-heart');
})
$('.wrap-2').on('click', function(){
$('.wrap-2 .span-1').toggleClass('go');
$('.wrap-2 .span-2').toggleClass('go');
$('.wrap-2 .span-3').toggleClass('go');
$('.wrap-2 .span-4').toggleClass('go');
$('.wrap-2 .symbol').toggleClass('go-heart');
})
This Pen doesn't use any external CSS resources.