css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

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

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

* {

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

body {
  font: 1em/1.65em sans-serif;
  color: #fff;

.wrapper {
  width: $width;
  height: $height;
  margin:0 auto;

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

.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% {
  99.99% {
    z-index: 2;
  100% { 
    transform: rotate(360deg);
    opacity: 0;
    z-index: -1;

.mask {
  top: -1px;
  left: -1px;
  width: $width + 2px;
  height: $height + 2px;
    linear-gradient(top, transparent 50%, $color-alpha 50%),
    linear-gradient(top, $color-alpha 50%, transparent 50%);
    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;
  background: $color-gamma;
  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.

  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

  # 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);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................