Skip to content

Instantly share code, notes, and snippets.

@19h
Created September 9, 2012 15:01
Show Gist options
  • Select an option

  • Save 19h/3684879 to your computer and use it in GitHub Desktop.

Select an option

Save 19h/3684879 to your computer and use it in GitHub Desktop.
Streaming audio player animation using modern CSS animations, transforms etc.
<div class="wrapper">
<div class="tower">
<div class="signal">
<div class="rings circle animated"></div>
</div>
<div class="dot circle"></div>
<div class="triangle"></div>
</div>
<div class="player circle">
<div class="buffering circle animated"></div>
<div class="triangle"></div>
</div>
<div class="text">
<div class="pulsing animated">Buffering</div>
</div>
</div>
/* small reset */
* { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;}
/* buffer */
@-webkit-keyframes rotate {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
@-moz-keyframes rotate {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
@-ms-keyframes rotate {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
@keyframes rotate {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
/* text */
@-webkit-keyframes pulse {
0% { opacity: 0; }
100% { opacity: 1; }
}
@-moz-keyframes pulse {
0% { opacity: 0; }
100% { opacity: 1; }
}
@-ms-keyframes pulse {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes pulse {
0% { opacity: 0; }
100% { opacity: 1; }
}
/* scale */
@-webkit-keyframes scale {
0% { -webkit-transform: scale(1.0); }
100% { -webkit-transform: scale(1.2); }
/*0% { width: 30px; height: 30px; margin: 0;}
/100% { width: 36px; height: 36px; margin: -3px 0 0 -3px; }*/
}
@-moz-keyframes scale {
0% { -webkit-transform: scale(1.0); }
100% { -webkit-transform: scale(1.2); }
}
@-ms-keyframes scale {
0% { -webkit-transform: scale(1.0); }
100% { -webkit-transform: scale(1.2); }
}
@keyframes scale {
0% { -webkit-transform: scale(1.0); }
100% { -webkit-transform: scale(1.2); }
}
/* globals */
body {
background-color: #E5DFDF;
}
.wrapper {
position: relative;
background-color: #E5DFDF;
margin: 40px auto 0 auto;
height: 480px;
width: 320px;
}
.circle {
/* Draw circles */
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.animated {
/* Smoother animations */
-webkit-transform: translateZ(0);
}
/* tower */
.tower {
position: absolute;
top: 12.5%;
width: 100%;
margin: -20px 0 0 0;
}
.tower .signal {
position: absolute;
top: 0px;
left: 50%;
margin: 0 0 0 -15px;
}
.tower .signal .rings {
width: 30px;
height: 30px;
border: 6px double #F2F0F0;
-webkit-animation: scale 1s infinite linear;
-moz-animation: scale 1s infinite linear;
-ms-animation: scale 1s infinite linear;
animation: scale 1s infinite linear;
}
.tower .dot {
margin: 10px auto 0 auto;
width: 10px;
height: 10px;
background-color: #F2F0F0;
}
.tower .triangle {
margin: -5px auto 0 auto;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 30px solid #F2F0F0;
}
/* player */
.player {
position: absolute;
top: 50%;
left: 50%;
margin: -120px 0 0 -120px;
height: 240px;
width: 240px;
background-color: #F2F0F0;
}
.player .triangle {
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
margin: -15px 0 0 -10px;
border-top: 20px solid transparent;
border-left: 30px solid #4BEADE;
border-bottom: 20px solid transparent;
}
.player:hover .triangle {
border-top: 20px solid transparent;
border-left: 30px solid #46CCBF;
border-bottom: 20px solid transparent;
}
.player .buffering {
position: absolute;
top: 5px;
left: 5px;
width: 230px;
height: 230px;
border-right: 2px solid #D3D1D1;
border-bottom: 2px solid #D3D1D1;
border-left: 2px solid #F2F0F0;
border-top: 2px solid #F2F0F0;
-webkit-animation: rotate 3s infinite linear;
-moz-animation: rotate 3s infinite linear;
-ms-animation: rotate 3s infinite linear;
animation: rotate 3s infinite linear;
}
/* text */
.text {
position: absolute;
top: 85%;
text-align: center;
text-transform: uppercase;
color: #C1B8B8;
font-family: "Helvetica Neue", Helvetica, sans-serif;
font-size: 14px;
width: 100%;
-webkit-animation: pulse 1.3s infinite;
-moz-animation: pulse 1.3s infinite;
-ms-animation: pulse 1.3s infinite;
animation: pulse 1.3s infinite;
}​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment