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.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

            
              %h1 For best view please use Chrome!
#robot
  #head
    .front
    .back
    .left
    .right
  #torso
    .front
    .back
    .left
    .right
  #left_arm
    .upper_arm
      .front
      .back
      .left
      .right
      .top
      .bottom
    .forearm
      .front
      .back
      .left
      .right
      .top
      .bottom
  #right_arm
    .upper_arm
      .front
      .back
      .left
      .right
      .top
      .bottom
    .forearm
      .front
      .back
      .left
      .right
      .top
      .bottom
  #left_leg
    .thigh
      .front
      .back
      .left
      .right
      .top
      .bottom
    .lower_leg
      .front
      .back
      .left
      .right
      .top
      .bottom
  #right_leg
    .thigh
      .front
      .back
      .left
      .right
      .top
      .bottom
    .lower_leg
      .front
      .back
      .left
      .right
      .top
      .bottom
            
          
!
            
              @import compass

$bg: #f6f5f1
$front: #9aacb1
$back: $front
$left: lighten($front, 10%)
$right: $left
$top: darken($front, 5%)
$bottom: $top

/* -------------------------------------
 * Style
 * ------------------------------------- */

body
  padding: 50px
  background: radial-gradient(1000px, $bg, darken($bg, 20%))
  background-repeat: no-repeat
  background-attachment: fixed

h1
  color: $front
  font: 24px Verdana, sans-serif
  font-weight: normal
  
#robot
  width: 300px
  height: 620px
  margin: 50px auto 0
  position: relative
  transform-style: preserve-3d
  transform-origin: 50% 0 -30px
  animation: spin 60s linear infinite

/*------- robot body -------*/

#head
  width: 60px
  height: 60px
  position: absolute
  top: 0
  left: 120px
#torso
  width: 200px
  height: 230px
  position: absolute
  top: 80px
  left: 50px
// arms
#left_arm
  width: 25px
  height: 240px
  position: absolute
  top: 110px
  left: 30px
#right_arm
  width: 25px
  height: 240px
  position: absolute
  top: 110px
  right: 30px
.upper_arm
  width: 25px
  height: 100px
  position: relative
  transform-style: preserve-3d // firefox
.forearm
  width: 25px
  height: 120px
  margin-top: 20px
// legs
#left_leg
  width: 30px
  height: 340px
  position: absolute
  top: 280px
  left: 85px
#right_leg
  width: 30px
  height: 340px
  position: absolute
  top: 280px
  right: 85px
.thigh
  width: 30px
  height: 150px
  position: relative
  transform-style: preserve-3d //firefox
.lower_leg
  width: 30px
  height: 170px
  margin-top: 20px

/*------- 3d effects -------*/

.front
  width: inherit
  height: inherit
  background: $front
  position: absolute
.back
  width: inherit
  height: inherit
  background: $back
  position: absolute
.left
  width: inherit
  height: inherit
  position: absolute
  background: $left
  transform-origin: 0 0 0
  transform: rotateY(90deg)
.right
  width: inherit
  height: inherit
  position: absolute
  background: $right
  transform-origin: 100% 0 0
  transform: rotateY(-90deg)
.top
  width: inherit
  background: $top
  position: absolute
  transform-origin: 0 0 0
  transform: rotateX(-90deg)
.bottom
  width: inherit
  background: $top
  position: absolute
  transform-origin: 0 0 0
  transform: rotateX(-90deg)

#head
  transform-style: preserve-3d
  transform-origin: 50% 0 -30px
  animation: torso 0.8s ease-in-out infinite alternate
  .back
    transform: translateZ(-60px)

#torso
  transform-style: preserve-3d
  transform-origin: 50% 0 -30px
  animation: torso 0.8s ease-in-out infinite alternate
  .front
    width: 0
    height: 0
    background: none
    border-top: 230px solid $front
    border-left: 100px solid transparent
    border-right: 100px solid transparent
  .back
    width: 0
    height: 0
    background: none
    border-top: 230px solid $back
    border-left: 100px solid transparent
    border-right: 100px solid transparent
    transform: translateZ(-60px)
  .left
    width: 60px
    height: 250px
    transform: rotateY(90deg) rotateX(23.5deg)
  .right
    width: 60px
    height: 250px
    transform: rotateY(-90deg) rotateX(23.5deg)
    right: 0

#left_arm, #right_arm
  transform-style: preserve-3d
  transform-origin: 0 0 -10px
  animation: arm 0.8s ease-in-out infinite alternate
  .back
    transform: translateZ(-25px)
  .top
    height: 25px
  .bottom
    height: 25px
    bottom: -25px
#right_arm
  animation-delay: 0.8s
  .forearm
    animation-delay: 0.8s
.forearm
  transform-style: preserve-3d
  transform-origin: 0 0 0
  animation: forearm 0.8s ease-in-out infinite alternate

#left_leg, #right_leg
  transform-style: preserve-3d
  transform-origin: 0 0 -20px
  animation: leg 0.8s ease-in-out infinite alternate
  .back
    transform: translateZ(-30px)
  .top
    height: 30px
  .bottom
    height: 30px
    bottom: -30px
#left_leg
  animation-delay: 0.8s
  .lower_leg
    animation-delay: 0.8s
.lower_leg
  transform-style: preserve-3d
  transform-origin: 0 0 0
  animation: lower_leg 0.8s ease-in-out infinite alternate

/*------- animation -------*/

@keyframes spin
  0%
    transform: rotateY(0deg)
  100%
    transform: rotateY(360deg)

@keyframes torso
  0%
    transform: rotateY(-7deg)
  100%
    transform: rotateY(7deg)

@keyframes arm
  0%
    transform: rotateX(-15deg) translateZ(-20px) // note
  100%
    transform: rotateX(20deg) translateZ(-20px) // note

@keyframes forearm
  0%
    transform: rotateX(0deg)
  100%
    transform: rotateX(60deg)

@keyframes leg
  0%
    transform: rotateX(-5deg) translateZ(-15px) // note
  100%
    transform: rotateX(25deg) translateZ(-15px) // note

@keyframes lower_leg
  0%
    transform: rotateX(0deg) translateY(15px)
  100%
    transform: rotateX(-50deg) translateY(15px)

// note: should remove translateZ for Safari. It is really weird that Safari and Chrome use different method to treat transform-origin property.
            
          
!
999px
🕑 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 ..................

Console