Skip to content

Instantly share code, notes, and snippets.

@jordanandree
Created October 22, 2012 18:10
Show Gist options
  • Save jordanandree/3933066 to your computer and use it in GitHub Desktop.
Save jordanandree/3933066 to your computer and use it in GitHub Desktop.
A CodePen by Jack Rugile. CSS3 Pseudo Sound Bars
<h1>CSS3 Pseudo Sound Bars</h1>
<div id="bars">
<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>
h1 {
color: #555;
font: bold 12px 'helvetica neue', helvetica, arial, sans-serif;
left: 0;
margin: 20px 0 0 0;
position: absolute;
top: 50%;
text-align: center;
width: 100%;
}
#bars {
height: 30px;
left: 50%;
margin: -30px 0 0 -20px;
position: absolute;
top: 50%;
width: 40px;
}
.bar {
background: #666;
bottom: 1px;
height: 3px;
position: absolute;
width: 3px;
animation: sound linear infinite alternate;
}
@keyframes sound {
0% {
opacity: .35;
height: 3px;
}
100% {
opacity: 1;
height: 28px;
}
}
.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