JSFiddle - React, Tailwind, and code Playground
by Tyler Brown
HTML
<div id="backdrop">
<div id="logo">
<div id="heighter">
<div class="bar" id="bar1"></div>
<div class="bar" id="bar2"></div>
<div class="bar" id="bar3"></div>
<div class="bar" id="bar4"></div>
</div>
</div>
</div>
CSS
div {
box-sizing: border-box;
}
#backdrop {
background-color: white;
height: 200px;
padding-top: 75px;
}
#logo {
width: 100px;
position: relative;
margin: 0 auto;
}
#heighter {
position: absolute;
width: 100%;
padding-top: 50%; /* width-height ratio hack */
}
.bar {
position: absolute;
bottom: 0;
width: 22%;
}
#bar1 {
background-color: #2DCCCD;
left: 0;
height: 80%;
}
#bar2 {
background-color: #001E40;
left: 26%;
height: 40%;
}
#bar3 {
background-color: #0071DC;
right: 26%;
height: 70%;
}
#bar4 {
background-color: #7BDBFF;
right: 0;
height: 90%;
}
@keyframes dance {
from { height: 10%; }
to { height: 100%; }
}
@keyframes dance-alt {
from { height: 100%; }
to { height: 10%; }
}
@keyframes drop {
to { height: 10%; }
}
@keyframes top {
to { height: 100%; }
}
.dance #bar1 {
animation: drop 200ms, dance 650ms infinite alternate ease-in 200ms;
}
.dance #bar2 {
animation: top 400ms, dance-alt 500ms infinite alternate ease-in 400ms;
}
.dance #bar3 {
animation: drop 200ms, dance 450ms infinite alternate ease-in 200ms;
}
.dance #bar4 {
animation: top 100ms, dance-alt 600ms infinite alternate ease-in 100ms;
}
JavaScript
$('#logo').mouseenter(function(e) {
$(this).addClass('dance');
});
$('#logo').mouseleave(function(e) {
$(this).removeClass('dance');
});