Skip to content

Instantly share code, notes, and snippets.

@ganapativs
Created December 20, 2014 19:26
Show Gist options
  • Save ganapativs/f815944285cbfb0951ce to your computer and use it in GitHub Desktop.
Save ganapativs/f815944285cbfb0951ce to your computer and use it in GitHub Desktop.
CSS3 Pseudo Sound Bars Two Sides
<h1>CSS3 Pseudo Sound Bars Two Sides</h1>
<div id="bars-up">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
<div id="bars-down">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
Inspired from <a href="http://codepen.io/jackrugile/pen/CkAbG">http://codepen.io/jackrugile/pen/CkAbG</a>
h1 {
color: #555;
font: bold 12px 'helvetica neue', helvetica, arial, sans-serif;
left: 0;
margin: 20px 0 0 0;
position: absolute;
top: 58%;
text-align: center;
width: 100%;
}
#bars-up {
height: 30px;
left: 50%;
margin: -30px 0 0 -20px;
position: absolute;
top: 50%;
width: 40px;
}
#bars-down {
height: 30px;
left: calc(50% + 1px);
margin: -30px 0 0 -20px;
position: absolute;
top: calc(50% + 30px);
width: 40px;
-webkit-transform:rotate(180deg);
}
.bar {
background: #666;
bottom: 0px;
height: 3px;
position: absolute;
width: 3px;
transition:0.5s;
animation: sound 0ms -800ms ease-in infinite alternate;
}
@keyframes sound {
0% {
opacity: .35;
height: 3px;
background: #333;
}
100% {
opacity: 1;
height: 28px;
background: #39a;
}
}
.bar:nth-child(1) { left: 1px; animation-duration: 474ms; }
.bar:nth-child(2) { left: 5px; animation-duration: 433ms; }
.bar:nth-child(3) { left: 9px; animation-duration: 407ms; }
.bar:nth-child(4) { left: 13px; animation-duration: 458ms; }
.bar:nth-child(5) { left: 17px; animation-duration: 400ms; }
.bar:nth-child(6) { left: 21px; animation-duration: 427ms; }
.bar:nth-child(7) { left: 25px; animation-duration: 441ms; }
.bar:nth-child(8) { left: 29px; animation-duration: 419ms; }
.bar:nth-child(9) { left: 33px; animation-duration: 487ms; }
.bar:nth-child(10) { left: 37px; animation-duration: 442ms; }​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment