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

              
                .ground-plane

.fan
  %input#switch{:type=>"checkbox"}
  .head
    .blades
      .blade
      .blade
      .blade
    .cover
    .center
  .support
  .base
  %label.switch{'for'=>'switch'}
              
            
!

CSS

              
                $fanColor: teal;
$fanTrim: silver;
$fanBladeColor: gray;
$fanMetal: #ccc;


html,body {
  width:100%;
  height:100%;
  position:relative;
}

body {
  background-color:skyblue;
  perspective:500px;
  overflow:hidden;
}

.ground-plane {
  position:absolute;
  width:1000%;
  height:calc(10% + 200px);
  bottom:0;
  left:-500%;
  background-color:darken(skyblue, 15%);
}

.fan {
  position:absolute;
  width:500px;
  height:500px;
  left:50%;
  bottom: 10%;
  transform:translateX(-50%);
}

input#switch {
  display:none;
}

.switch {
  position:absolute;
  background-color: darken($fanMetal,15%);
  border:5px solid $fanMetal;
  height:25px;
  width:15px;
  border-radius:50%;
  bottom:70px;
  left:35%;
  
  &:before {
    content:"";
    width:30px;
    height:10px;
    position:absolute;
    right:-2px;
    top:50%;
    transform-origin:100% 50%;
    transform:translateY(-50%)rotate(-20deg);
    background-color:$fanMetal;
    border-radius:5px 0 0 5px;
    transition:all 150ms; 
  }
}

#switch:checked {
  &~.switch:before  {
    transform:translateY(-50%)rotate(20deg);
  }
  &~.head .blades  {
    animation:spin 1s linear infinite;
  }
}

.head {
  position:absolute;
  top:0;
  left:60%;
  transform:translateX(-50%) rotateY(3deg);
  border:10px solid $fanTrim;
  width:300px;
  height:300px;
  border-radius:50%;
  z-index:5;
  box-shadow :
    -1px 0px 0px 0px darken($fanTrim, 5%), 
    -2px 0px 0px 0px darken($fanTrim, 5%),
    -3px 0px 0px 0px darken($fanTrim, 5%),
    -4px 0px 0px 0px darken($fanTrim, 5%),
    -5px 0px 0px -1px darken($fanTrim, 5%),
    -6px 0px 0px -1px darken($fanTrim, 5%),
    -7px 0px 0px -1px darken($fanTrim, 5%),
    -8px 0px 0px -1px darken($fanTrim, 5%),
    -10px 0px 0px -1px darken($fanTrim, 5%),
    -12px 0px 0px -1px darken($fanTrim, 5%),
    -14px 0px 0px -1px darken($fanTrim, 5%),
    -16px 0px 0px -1px darken($fanTrim, 5%);
}

.blades {
  //todo: Add rotation animation
  position:absolute;
  height:100%;
  width:100%;
  z-index:2;
  animation:spinDown 1s ease-out forwards;
  //
}

@keyframes spin {
  0% {
    transform:rotate(0deg);
  }
  100% {
    transform:rotate(360deg);
  }
}
@keyframes spinDown {
  0% {
    transform:rotate(-360deg);
  }
  100% {
    transform:rotate(0deg);
  }
}
.blade {
  position:absolute;
  width:20%;
  height:45%;
  top:5%;
  left:50%;
  background-color:$fanBladeColor;
  transform-origin:50% 100%;
  transform: perspective(150px) translateX(-50%) ;
  border-radius:50% 20px 20px 20px / 10px 100px 10px 10px;
  
  &:nth-child(2) {
    transform: perspective(150px) translateX(-50%) rotateZ(120deg);
  }
  
  &:nth-child(3) {
    transform: perspective(150px) translateX(-50%) rotateZ(-120deg);
  }
  
  &:before {
    content:"";
    position:absolute;
    top:0;
    left:0;
    width:60%;
    height:100%;
    background-color:lighten($fanBladeColor, 5%);
    transform:skewX(8deg);
    border-radius:20px 0 0 0;
    transform-origin:100% 100%;
  } 
}
.center {
  position:absolute;
  border-radius:50%;
  left:50%;
  top:50%;
  width:25%;
  height:25%;
  transform:translate(-50%, -50%);
  background-color:$fanTrim;
  z-index:10;
  box-shadow :
    inset 1px 0px 0px 2px darken($fanTrim, 5%), 
    inset 2px 0px 0px 2px darken($fanTrim, 5%),
    inset 3px 0px 0px 2px darken($fanTrim, 5%),
    inset 4px 0px 0px 2px darken($fanTrim, 5%),
    inset 5px 0px 0px 6px darken($fanTrim, 5%),
    inset 6px 0px 0px 6px darken($fanTrim, 5%),
    inset 7px 0px 0px 6px darken($fanTrim, 5%),
    inset 8px 0px 0px 6px darken($fanTrim, 5%);
}

.cover {
  position:absolute;
  width:100%;
  height:100%;
  border-radius:50%;
  z-index:10;
  background-image: radial-gradient(circle, 
    transparent 20%, $fanMetal 20%, $fanMetal 22%, transparent 22%,
    transparent 40%, $fanMetal 40%, $fanMetal 42%, transparent 42%,
    transparent 60%, $fanMetal 60%, $fanMetal 62%, transparent 62%
  );
  
  &:before,
  &:after {
    content:"";
    height:100%;
    width:5px; 
    position:absolute;
    left:50%;
    top:0;
    transform-origin:50% 50%;
    background-color:$fanMetal;
  }
  
  &:before {
    transform:translateX(-50%) rotate(45deg);
  }
  &:after {
    transform:translateX(-50%) rotate(-45deg);
  }   
}

.support {
  position:absolute;
  z-index:1;
  width:60px;
  height:40%;
  top:150px;
  left:50%;
  background-color:$fanColor;
  transform-origin:50%, 100%;
  transform:perspective(100px) rotateX(15deg);
  outline: 1px solid transparent;
  
  &:before {
    content:"";
    position:absolute;
    left:0;
    top:0;
    width:30%;
    height:100%;
    background-color:darken($fanColor,5%);
  }
  
  &:after {
    content:"";
    position:absolute;
    top:-100px;
    left:-100px;
    height:125px;
    width:150px;
    border-radius: 50% 0 0 50%;
    background-color:darken($fanColor, 5%);
  }
}

.base {
  position:absolute;
  bottom:20px;
  left:55%;
  width:40%;
  height:40%;
  transform-origin:50% 50%;
  transform:translateX(-50%) scaleY(.2);
  background:$fanColor;
  border-radius:50%;
  z-index:0;
  box-shadow: 
    0px 20px 0px 1px darken($fanColor, 5%),
    0px 40px 0px 2px darken($fanColor, 5%),
    0px 60px 0px 3px darken($fanColor, 5%),
    0px 80px 0px 4px darken($fanColor, 5%),
    0px 100px 0px 5px darken($fanColor, 5%),
    0px 120px 0px 6px darken($fanColor, 5%),
    0px 140px 0px 7px darken($fanColor, 5%),
    0px 160px 0px 8px darken($fanColor, 5%),
    0px 180px 0px 9px darken($fanColor, 5%),
    0px 200px 0px 10px darken($fanColor, 5%),
    0px 220px 0px 11px darken($fanColor, 5%);
}

              
            
!

JS

              
                //Click the switch on the base
              
            
!
999px

Console