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.

            
              .daruma 
  .daruma__face
    .daruma__eye
    .daruma__eye.active
    .daruma__mustache
    .daruma__nose
    .daruma__eyebrow
  .daruma__chin
    -(0...6).each do |i|
      .daruma__chin_mark
      
.daruma_shadow
            
          
!
            
              // Frameworks and Mixins
// ---------------------------
@import bourbon
  
=block($w, $h)
  display: block
  width: $w
  height: $h
  
=absolute($top, $left)
  position: absolute
  top: $top
  left: $left
  
// Colors
// ---------------------------
$primary: red
$secondary: gold
$face: white
$dark_gold: darken($secondary, 10%)
$black: #555
$background: desaturate(#e7a61a, 30%)
	
// Daruma Styles
// ---------------------------

// BODY ----------------------
.daruma
  // sizing and poition
  +block(40vh, 40vh)
  display: inline-block
  position: relative
  margin-top: 30vh
  z-index: 9999
    
  // shape
  +border-top-radius(50%)
  +border-bottom-radius(40%)
  
  // color
  background: $primary
  box-shadow: inset -1vh -2vh 0px 0px darken($primary, 20%)
  
  // animations
  +transform-origin(center center)
  +animation(daruma 2.0s $ease-in-out-cubic)
  +animation-iteration-count(infinite)
  
  &:before
    content: ''
    +block(36vh, 38vh)
    margin: 0.7vh 1vh
    +border-top-radius(50%)
    +border-bottom-radius(40%)
    box-shadow: inset 1vh 1vh 0px 0px rgba(255,255,255,0.3)
 
  
// FACE ----------------------
.daruma__face
  +block(80%, 60%)
  +absolute(10%, 10%)
  +border-top-radius(50%)
  +border-bottom-radius(30%)
  background: $face
  overflow: hidden
  box-shadow: inset 0vh -1.5vh 0px 0px darken($primary, 20%)
  +transform-style(preserve-3d)
  
  &:before
    content: ''
    +block(100%, 10%)
    margin-top: 0%
    background: $primary
    border-radius: 50%
    box-shadow: 0vh 1vh 0px 0px fade-out($black, 0.8)
    position: relative
    z-index: 9999
  
  
$eye_distance: 3.8vh
.daruma__eye
  box-sizing: border-box
  +block(10vh, 10vh)
  +absolute(20%, $eye_distance)
  border: 1.2vh solid $black
  border-radius: 50%
  box-shadow: 0px 0px 2vh 2vh $dark_gold
  background: white
  z-index: 10
  overflow: hidden
  
  &+.daruma__eye
    left: auto
    right: $eye_distance
  
  &.active:before
    content: ''
    +block(6vh, 6vh)
    background: black
    border-radius: 50%
    margin: 1vh auto
    
  &.active:after
    content: ''
    +block(100%, 100%)
    +absolute(-100%, 0px)
    background: $dark_gold
    +animation(blink 4.0s $ease-in-out-cubic)
    +animation-iteration-count(infinite)
    
.daruma__mustache
  &:before, &:after
    content: ''
    box-sizing: border-box
    +block(12vh, 10vh)
    +absolute(44%, $eye_distance/2)
    box-shadow: inset 0.8vh -1vh 0px 0.8vh darken($black, 20%)
    border-radius: 45%
  
  &:after
    left: auto
    right: $eye_distance/2
    box-shadow: inset -0.8vh -1vh 0px 0.8vh darken($black, 20%)
  
.daruma__nose
  +block(3vh, 5vh)
  +absolute(54%, 50%)
  +transform(translateX(-50%))
  z-index: 11
  border-bottom: 0.8vh solid darken($primary, 10%)
  
  &:before, &:after
    content: ''
    +block(100%, 70%)
    position: absolute
    bottom: -10%
    right: -60%
    border-radius: 50%
    box-shadow: inset -0.3vh 1vh 0px 0.1vh darken($primary, 10%)
  
  &:after
    right: auto
    left: -60%
    box-shadow: inset 0.3vh 1vh 0px 0.1vh darken($primary, 10%)

.daruma__eyebrow
  &:before, &:after
    content: '’'
    font-family: georgia, serif
    font-size: 12vh
    box-sizing: border-box
    +block(12vh, 10vh)
    +absolute(6.5%, $eye_distance*2)
    z-index: 15
    
  &:before
    +transform-style(preserve-3d)
    +transform(rotateY(180deg))
      
  &:after
    left: auto
    right: $eye_distance*2
   
    
// CHIN --------------------
.daruma__chin
  +block(70%, 15%)
  position: absolute
  bottom: 14.5%
  left: 15%
  
.daruma__chin_mark
  +block(10%, 100%)
  float: left
  /* background: linear-gradient($secondary, fade-out($secondary, 0.9)) */
  margin: 0 2%
  +border-top-radius(50%)
  +border-bottom-radius(50%)
  box-shadow: inset 2vh 1.5vh 0px 0px $secondary
  
  &:nth-child(2), &:nth-child(5)
    margin-top: 4%
  &:nth-child(3), &:nth-child(4)
    margin-top: 6%

  &:nth-child(4)
    margin-left: 18%
  &:nth-child(n+4)
    box-shadow: inset -2vh 1.5vh 0px 0px $secondary
  
  
.daruma_shadow
  +block(30vh, 4vh)
  +absolute(70.5vh, calc(50vw - 15vh))
  border-radius: 50%
  background: darken($background, 20%)
  +animation(shadow 2.0s $ease-in-out-cubic)
  +animation-iteration-count(infinite)
    
    
// Animations
// ---------------------------
+keyframes(daruma)
  0%
    +transform(rotate(-20deg))
    left: -12vh
  50%
    +transform(rotate(25deg))
    left: 12vh
  100%
    +transform(rotate(-20deg))
    left: -12vh
    
+keyframes(shadow)
  0%
    +transform(translateX(-8vh))
  50%
    +transform(translateX(8vh))
  100%
    +transform(translateX(-8vh))
    
+keyframes(blink)
  0%
    top: -100%
  80%
    top: -100%
  83%
    top: 0%
  86%
    top: 0%
  90%
    top: -100%
  

// Document Styles 
// (I put there at the end, because they aren't the focus)
// ---------------------------
body
  background: $background
  text-align: center
            
          
!
            
              ###
Yes, its only meant to have one eye.

Learn about Daruma here:
https://en.wikipedia.org/wiki/Daruma_doll
###
            
          
!
999px
Loading ..................

Console