Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="player">
  <div class="big">
    <span class="fontawesome-play play"></span>
    <span class="fontawesome-pause pause"></span>
  </div>
  <div class="small left">
    <span class="fontawesome-fast-backward"></span>
  </div>
  <div class="small right">
    <span class="fontawesome-fast-forward"></span>
  </div>
  <div class="star-tab">
    <span class="fontawesome-star"></span>
  </div>
  <div class="plaque"></div>
  <div class="scrub-bg">
    <div class="scrubber"></div>
  </div>
</div>
              
            
!

CSS

              
                @import "compass/css3";

@import url(http://weloveiconfonts.com/api/?family=fontawesome);

$scale: 1.25rem;
$big: 6em;
$big-bg: $big * 1.2;
$big-bg-top-offset: $big * -0.1;
$scrub-bg: $big * 1.4;
$scrub-bg-top-offset: ($scrub-bg - $big) / -2;
$small: $big / 2;
$small-top-offset: $small / -3;
$small-bg: $small * 1.2;
$small-bg-offset: -1.7em;
$tab: $big * 1.8;
$tab-top-offset: ($tab - $big) / -2;
$player-width: ($big * 2) + ($small-top-offset * 2);
$player-height: ($big + $small) + $small-top-offset;

$clear: hsla(0,0,100%,0);
$white: hsl(215, 18%, 95%);
$gray: darken($white, 8%);
$plaque: hsl(160, 6%, 85%);
$tab-color: rgba(44, 62, 80,.8);
$scrub-color: rgba(26, 188, 156,.5);
$icon-color: hsl(160, 5%, 80%);
$iconhover:  hsl(160, 6%, 84%);

$shortsition: all 80ms;
$longsition: all 0.2s ease-in-out;
$animation: 6s linear infinite alternate;

* { margin:0; padding:0 }
html,body { height:100% }
body { background:radial-gradient(circle at top,#f9f9f9,#9f9f9f) }

// ******** Player *********

.player {
  position: relative;
  font-size: $scale;
  width: $player-width;
  height: $player-height;
  -webkit-user-select: none;
     -moz-user-select: none;
  /* Screen Centering: */
  top: 50%; left: 50%;
  margin: ($player-height / -2) 0 0 ($player-width / -2);
}

// ********* Font Icons ********

[class*="fontawesome-"]::before {
  font-family: 'FontAwesome', sans-serif;
  position: relative;
  display: block;
  text-align: center;
  color: $icon-color;
  line-height: $small;
  text-shadow: 0 -0.03em rgba(#000,0.2),
               0 0.03em 0.03em rgba(#fff,0.55);
  transition: $shortsition;
}

.big:hover > [class*="fontawesome-"]::before,
.small:hover > [class*="fontawesome-"]::before,
.dl-tab:hover > [class*="fontawesome-"]::before {
  color: $iconhover;
}

// ******** Big Play/Pause ********

.big {
  position: relative;
  z-index: 9;
  cursor: pointer;
  height: $big;
  width: $big;
  margin: 0 auto;
  border-radius: 100%;
  background: radial-gradient(circle at 50% 5%, $white, $gray);
  box-shadow:
    0 0.22em 0.3em -0.22em rgba(#000,0.7),
    inset 0 0.2em 0.4em -0.22em rgba(#fff,0.9);
  transition: $shortsition;

  & > span { font-size:2em }
}

.big:hover {
  background: radial-gradient(circle at 50% 5%, lighten($white,1%), lighten($gray,1%));
}

.big:hover::before {
  background: radial-gradient(circle at 50% 92%, lighten($white,1%), lighten($gray,1%));
}

.big:active {
  box-shadow:
    0 0.22em 0.3em -0.24em rgba(#000,0.6),
    inset 0 0.2em 0.4em -0.22em rgba(#fff,0.8);
  background: radial-gradient(circle at 50% 5%, $white, $gray);
  top: 0.03em;
}

.big:active::before {
  background: radial-gradient(circle at 50% 92%, $white, $gray);
}

.big::before {
  position: absolute; content:'';
  width: 60%; height: 60%;
  margin: 20%;
  border-radius: 100%;
  background: radial-gradient(circle at 50% 92%, $white, $gray);
  transition: $shortsition;
}

.play     { display:none }
.play.on  { display:block }
.pause    { display:block }
.pause.on { display:none }

// ******** Small Forward Backward *********

.small {
  position: relative;
  z-index: 9;
  cursor: pointer;
  top: $small-top-offset;
  width: $small; height: $small;
  border-radius: 100%;
  background: radial-gradient(circle at 50% 10%, lighten($white,0.5%), darken($gray,0.5%));
  box-shadow:
    0 0.22em 0.27em -0.18em rgba(#000,0.45),
    inset 0 0.15em 0.2em -0.15em rgba(#fff,0.8);
  transition: $shortsition;
}

.small:hover {
  background: radial-gradient(circle at 50% 5%, lighten($white,2%), lighten($gray,1.5%));
}

.small:active {
  top: $small-top-offset + 0.03em;
  background: radial-gradient(circle at 50% 5%, $white, $gray);
  box-shadow:
    0 0.18em 0.22em -0.16em rgba(#000,0.43),
    inset 0 0.15em 0.25em -0.2em rgba(#fff,0.75);
}

// ********* Background Plaque *********

.plaque {
  position: absolute; z-index: 8;
  top: $big-bg-top-offset; left: $big-bg / -2;
  width: $big-bg; height: $big-bg;
  margin-left: 50%;
  border-radius: 100%;
  background: $plaque;
  box-shadow:
    inset 0 0.1em 0.07em -0.03em rgba(#fff,0.75),
    0 0.25em 0.25em -0.175em rgba(#000,0.4);
}

.plaque::before,
.plaque::after {
  position: absolute; content:'';
  bottom: $small-bg-offset;
  width: $small-bg; height: $small-bg;
  border-radius: 100%;
  background: $plaque;
}

.plaque::before {
  left: $small-bg-offset;
  box-shadow:
    inset 0.1em 0.18em 0.02em -0.17em rgba(#fff,0.7),
    0 0.25em 0.25em -0.15em rgba(#000,0.5);
}

.plaque::after {
  right: $small-bg-offset;
  box-shadow:
    inset -0.1em 0.18em 0.02em -0.17em rgba(#fff,0.7),
    0 0.25em 0.25em -0.15em rgba(#000,0.5);
}

.left  { float:left }
.right { float:right }

// ********* Star Tab *********

.star-tab {
  position: absolute; z-index: 6;
  top: $tab-top-offset; left: $tab / -2;
  width: $tab; height: $tab;
  cursor: pointer;
  margin-left: 50%;
  border-radius: 100%;
  clip: rect(($tab * 0.75), ($tab * 0.75), ($tab * 1.025), ($tab * 0.25));
  background: radial-gradient($tab-color, lighten($tab-color, 3%));
  box-shadow: 0 0.2em 0.2em -0.15em rgba(#000,0.5);
  transition: $longsition 0.05s;

  & > [class*="fontawesome-"]::before {
      top: $tab - 2.4;
      color: $white;
      text-shadow: 0 0.03em 0.06em rgba(#000,0.35),
                   0 -0.03em rgba(#fff,0.15);
  }
}

.star-tab:hover {
  top: $tab-top-offset + 0.2;
  background: radial-gradient($tab-color, lighten($tab-color, 5%));
}

// ********* Scrubber *********

.scrub-bg {
  position: absolute; z-index: 5;
  top: $scrub-bg-top-offset; left: $scrub-bg / -2;
  width: $scrub-bg; height: $scrub-bg;
  margin-left: 50%;
  border-radius: 100%;
  clip: rect(($scrub-bg * -0.02), ($scrub-bg * 1.02), ($scrub-bg * 0.75), ($scrub-bg * -0.02));
  background: darken($plaque, 4%);
  box-shadow:
    inset 0 0.18em 0.25em -0.15em rgba(#000,0.5),
    0 0.1em 0.03em 0 rgba(#fff,0.3);
}

.scrubber {
  position: absolute; z-index: 6;
  margin-left: 50%;
  left: $scrub-bg / -2;
  border-radius: 100%;
  border: ($scrub-bg / 2) solid;
  animation: scrub $animation;
  -webkit-animation: scrub $animation;
}

.scrubber::before {
  position: absolute; content:'';
  cursor: pointer;
  top: (($scrub-bg / 2) * 0.75) - ($scrub-bg-top-offset / -2) - 0.11;
  left: (($scrub-bg / -2) * 0.75) + 0.11;
  width: $scrub-bg-top-offset / -2;
  height: $scrub-bg-top-offset / -2;
  border-radius: 100%;
  background: radial-gradient(circle at 50% 5%, $white,$gray);
  box-shadow:
    0 0.1em 0.15em -0.08em rgba(#000,0.45),
    inset 0 0.08em 0.02em 0 rgba(#fff,0.75);
  animation: scrubber $animation;
  -webkit-animation: scrubber $animation;
}

// ********* Animations *********

@keyframes scrubber {
  from { transform:rotate(-24deg) }
    to { transform:rotate(-246deg) }
}

@-webkit-keyframes scrubber {
  from { -webkit-transform:rotate(-24deg) }
    to { -webkit-transform:rotate(-246deg) }
}

@keyframes scrub {
  0% {
  border-color: $clear $clear $scrub-color;
  transform: rotate(24deg);
  }
  32.9% {
  border-color: $clear $clear $scrub-color;
  }
  33% {
  border-color: $clear $scrub-color $scrub-color $clear;
  }
  65.9% {
  border-color: $clear $scrub-color $scrub-color $clear;
  }
 66% {
  border-color: $scrub-color $scrub-color $scrub-color $clear;
  }
100% {
  border-color: $scrub-color $scrub-color $scrub-color $clear;
  transform: rotate(246deg);
  }
}

@-webkit-keyframes scrub {
  0% {
  border-color: $clear $clear $scrub-color;
  -webkit-transform: rotate(24deg);
  }
  32.9% {
  border-color: $clear $clear $scrub-color;
  }
  33% {
  border-color: $clear $scrub-color $scrub-color $clear;
  }
  65.9% {
  border-color: $clear $scrub-color $scrub-color $clear;
  }
 66% {
  border-color: $scrub-color $scrub-color $scrub-color $clear;
  }
100% {
  border-color: $scrub-color $scrub-color $scrub-color $clear;
  -webkit-transform: rotate(246deg);
  }
}
              
            
!

JS

              
                /*
IDEA FROM THIS DRIBBBLE: http://dribbble.com/shots/793099-Player-Widget?list=users

Looks best in Firefox.

Click the buttons!

Fully scalable, just change the font-size of the .player 

If anyone is good enough to actually add funcionality to this I'd be stoked!!

Still not 100% on the colors, and the "star tab" is at about 20%..

My biggest accomplishment with this was the scrub animation. I knew I could just animate a rotation to get the effect but the hard part was figuring out how to only get it to appear in the area that has been scrubbed. If 1/2 of it's diameter was hidden it'd have been a lot easier, but with only 1/3 of it being hidden I finally came up with the idea to just animate each single border from transparent to colored as it rotates. Pretty simple idea but it gave me the most trouble to come up with.

I changed the "download tab" to a "star tab", but what I really want to do is remove the "tab" all together and put a volume control in that area. I have yet to figure out a design for the volume control though.

I had to use a seperate div for the background circles instead of ::after pseudos because I ran into z-index problems with the .star-tab needing to be on the bottom layer.
Here's the code for the old pseudos:

.big::after,
.small::after {
  position: absolute;
  z-index: -1;
  content:'';
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  border-radius: 100%;
  
  background: $plaque;
}

.big::after {
  box-shadow: inset 0 0.125em 0.0625em -0.0625em rgba(#fff,0.8),
              0 0.25em 0.25em -0.1875em rgba(#000,0.4);
}

.small::after {
  box-shadow: 0 0.25em 0.25em -0.1875em rgba(#000,0.45);
}

*/

// Used to change the play/pause icon on click:
$(".big").click(function() {
  $(".play, .pause").toggleClass("on");
});
              
            
!
999px

Console