cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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.

            
              .nexus
 img(src='http://rednosemonkey.com/img/nexus5.png' width="306" height="600")
.container
 - for (var i = 0; i < 4; i++)
   span

            
          
!
            
              $size: 30px;

height,
body {
  height: 100%;
  background: #e67e22;
}

* { box-model: border-box; }

.nexus {
  position: absolute;
  text-align: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  &:before {
    position: absolute;
    content: "";
    display: block;
    width: 290px;
    height: 140px;
    left: 50%; margin-left: -145px;
    background: url("http://rednosemonkey.com/img/google-logo-290.min.png") no-repeat 50% 80px;
    background-size: 50%;
  }
}

.container {
  position: absolute;
  top: 50%;
  left: 50%;
   animation: rotate 7s infinite forwards linear; 
}

span {
  position: absolute;
  display: inline-block;
  width: $size;
  height: $size;
  border-radius: 50%;
  top: 50%; left: 50%;
  margin: -$size / 2;
  animation: 1.25s infinite forwards linear;
  
  &:nth-child(1) {
      background-color: red;
      animation-name: flip-right;
  }
    
  &:nth-child(2) {
      background-color: yellow;
      animation-name: flip-bottom;
  }
        
  &:nth-child(3) {
      background-color: green;
      animation-name: flip-left;
  }
        
  &:nth-child(4) {
      background-color: blue;
      animation-name: flip-top;
  }
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes flip-right {
  0% {
    transform: translate(0, 0) scaleX(1);
  }
  
  5% {
    transform: translateX((sin(1 * 90deg))*$size) scaleX(0.1);
    transform-origin: 0 50%;
  }
  
  25% { 
    transform: translateX((sin(1 * 90deg))*$size/1.3);
    background-color: red;
  }
  
  90% {
    transform: translate(0, 0) scaleX(1);
    background-color: rgba(red, 0.5);
  }
  
  100% {
    transform: translate(0, 0) scaleX(1);
    background-color: rgba(white, 0.25);
  }
}

@keyframes flip-left {
  0% {
    transform: translate(0, 0) scaleX(1);
  }
  
  5% {
    transform: translateX((sin(3 * 90deg))*$size) scaleX(0.1);
    transform-origin: 100% 50%;
  }
  
  25% { 
    transform: translateX((sin(3 * 90deg))*$size/1.3);
    background-color: green;
  }
  
  90% {
    transform: translate(0, 0) scaleX(1);
    background-color: rgba(green, 0.5);
  }
  
  100% {
    transform: translate(0, 0) scaleX(1);
    background-color: rgba(white, 0.25);
  }
}

@keyframes flip-top {
  0% {
    transform: translate(0, 0) scaleY(1);
  }
  
  5% { 
   transform: translateY((cos(2 * 90deg))*$size) scaleY(0.1);
    transform-origin: 50% 100%;
  }
  
  25% { 
   transform: translateY((cos(2 * 90deg))*$size/1.3);
    background-color: blue;
  }
  
  90% {
    transform: translate(0, 0) scaleX(1);
    background-color: rgba(blue, 0.5);
  }
  
  100% {
    transform: translate(0, 0) scaleY(1);
    background-color: rgba(white, 0.25);
  }
}

@keyframes flip-bottom {
  0% {
    transform: translate(0, 0) scaleY(1);
  }
  
  5% { 
   transform: translateY((cos(4 * 90deg))*$size) scaleY(0.1);
    transform-origin: 50% 0;
  }
  
  25% { 
   transform: translateY((cos(4 * 90deg))*$size/1.3);
    background-color: yellow;
  }
  
  90% {
    transform: translate(0, 0) scaleX(1);
    background-color: rgba(yellow, 0.5);
  }
  
  100% {
    transform: translate(0, 0) scaleY(1);
    background-color: rgba(white, 0.25);
    box-shadow: 0 0 1px rgba(white, 0.25);
  }
}

            
          
!
            
              /*

The bootloader for my Nexus 7, running Android 4.4 (KitKat). Animation not quite right, but close enough for now!

I wanted to try a quick go at copying the animation in CSS before updating my Nexus to Lollipop.

A video of the animation can be seen towards the end of this video:

http://www.youtube.com/watch?v=mHJV_UprpE8

*/
            
          
!
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