cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

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
Loading ..................

Console