cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

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.

            
              <div class="wrapper">
  <div class="content">
    This is a good day. Maybe.
  </div>
  <div class="rotate"></div>
  <div class="mask"></div>
</div>

<button data-type="restart">restart</button>
            
          
!
            
              @import "compass/css3";

* {
  box-sizing:border-box;
}

$width: 200px;
$height: 200px;
$duration: 2s;
$delay: 1s;
$color-alpha: #308991;
$color-beta: #80c144;
$color-gamma: #b83d54;

body {
  background:$color-alpha;
  font: 1em/1.65em sans-serif;
  color: #fff;
}

.wrapper {
  position:relative;
  width: $width;
  height: $height;
  margin:0 auto;
  overflow:hidden;
}

.content {
  width: $width;
  height: $height;
  background: $color-beta;
  border-radius: 50%;
  padding: 2em;
  overflow: hidden;
  text-align:center;
}

.rotate {
  position: absolute; 
  z-index: 2;
  top: 0;
  right: 0;
  width: $width / 2;
  height: $height;
  box-shadow:0 0 0 .15em $color-alpha;
  background: $color-alpha;
  transform-origin: 0 50%;
  animation: rotate $duration linear 1 forwards;
  animation-delay: $delay;
}

@keyframes rotate {
  0%   { 
    transform: rotate(0deg);
  }
  62% {
    opacity:1;
  }
  99.99% {
    z-index: 2;
  }
  100% { 
    transform: rotate(360deg);
    opacity: 0;
    z-index: -1;
  }
}

.mask {
  position:absolute;
  z-index:1;
  top: -1px;
  left: -1px;
  width: $width + 2px;
  height: $height + 2px;
  background: 
    linear-gradient(top, transparent 50%, $color-alpha 50%),
    linear-gradient(top, $color-alpha 50%, transparent 50%);
  background: 
    linear-gradient(to top, transparent 50%, $color-alpha 50%),
    linear-gradient(to top, $color-alpha 50%, transparent 50%);
  background-position:100% 100%, 0 0;
  background-size: 50% 200%;
  background-repeat: no-repeat;
  border-radius: 50%;
  box-shadow:0 0 0 .65em $color-alpha;
  
  animation: mask $duration / 1.25 linear 1 forwards; 
  animation-delay: (-$duration / 7.5) + $delay;
}

@keyframes mask {
  50% {
    background-position: 100% 0, 0 0;
  }
  
  99.99% {
    z-index: 1;
  }
  
  100% {
    background-position: 100% 0, 0 100%;
    z-index: -1;
  }
}

button {
  display: block;
  width: 7em;
  height: 4em;
  margin: 3em auto 0 auto;
  font-size: 1em;
  border:none;
  background: $color-gamma;
  color:inherit;
  cursor:pointer;
  transition:transform .2s ease-in-out;
  &:hover {
    transform: scale(1.5);
  }
  
  &:active {
    transform: scale(1.5) translateY(5%);
  }
}
            
          
!
            
               /**
  1/2 clock animation

  # What?
  My answer for a question at SO.
  http://stackoverflow.com/questions/14374092/making-div-animate-and-appear-rotating-clockwise-i-e-radialwipe-clock-effect-for

  It's as good as I can do it :(

  Please note: I need to add the wrapper-element because of this bug:
  overflow:hidden + border-radius does not work when transform is added to child
  https://bugs.webkit.org/show_bug.cgi?id=98538

  # 2013 by Tim Pietrusky
  # timpietrusky.com
**/

var button = document.querySelector('button[data-type="restart"]');

/*
 * Restart the animation by clone/delete/addToParent
 * the .wrapper dom element
 */
button.addEventListener('click', function() {
  var elm = document.querySelector('.wrapper'),
      newone = elm.cloneNode(true);

  elm.parentNode.replaceChild(newone, elm);
});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console