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.

            
              .lo-res
  .eye
    ul
      li.eyelash
      each i in new Array(4)
        li.eyelash.p-anim
      li.eyelash
    .eye__contour
      .eye__ball.p-circle
        .eye__pupil.p-circle
    ul
      each i in new Array(4)
        li.eyelash--bottom
            
          
!
            
              // COLOR VARIABLES
$c-01: #6d6e72; // Gray
$c-02: #e6e6e6; // Light Gray
$c-03: #41D3BD; // Turquoise Max
$c-04: #e47875; // Red
$c-05: #e2a766; // Gold
$c-06: #111213; // Black

// SIZE VARIABLES
$width: 90px; // Resize eye by editing only this variable
$height: ($width / 2);
$border: $width / 40;
$border_2x: $border * 2;
$overflow: $width / 14;
$eye_width: $width - ($overflow * 2) + $border_2x - 0.5;
$eye__ball: $height + $border_2x;
$eye__pupil: $eye__ball / 5;
$eyelash: $border * 4;

// MIXINS
@mixin make-shape($w, $h: $w) {
  width: $w;
  height: $h;
}

@mixin half-shape($color) {
  border-bottom-left-radius: $width;
  border-bottom-right-radius: $width;
  border: $border solid $color;
  border-top: none;
}

@mixin center-hztl($m-left) {
  margin-left: -($m-left / 2);
  position: absolute;
  left: 50%;
}

@mixin make-rotate ($deg, $t: null, $r: null, $b: null, $l: null) {
  transform: rotate($deg);
  top: $t;
  right: $r;
  bottom: $b;
  left: $l;
}

// LAYOUT
* {
  box-sizing: border-box;
}

body {
  background-color: $c-06;
  text-align: center;
}

body,
ul,
li {
  margin: 0;
  padding: 0;
}

ul {
  list-style-type: none;
}

// PATTERNS
.p-circle {
  border-radius: 50%;
}

.p-anim {
  animation: color-eyelashes 1s 2s forwards;
}

// LO-RES CANVAS 
.lo-res {
	@include make-shape(128px, 256px);
	background-color: $c-06;
	padding-top: round($width / 2.2);
	position: relative;
}

// ILLUSTRATION
.eye {
  @include make-shape($width - $border_2x, $height * 3);
  margin: 8% auto;
  position: relative;
  
  &lash {
    @include make-shape($eyelash);
    background-color: $c-01;
    border-radius: 0 ($eyelash * 1.5) ($eyelash * 1.5);
    position: absolute;
    z-index: 90;

    &:first-child {
      @include make-rotate(-45deg, 31%, null, null, -6%);
    }

    &:nth-child(2) {
      @include make-rotate(-10deg, 11%, null, null, 0);
    }

    &:nth-child(3) {
      @include make-rotate(20deg, 0, null, null, 27.5%);
    }

    &:nth-child(4) {
      @include make-rotate(60deg, 0, 27.5%, null, null);
    }

    &:nth-child(5) {
      @include make-rotate(100deg, 11%, 0, null, null);
    }

    &:last-child {
      @include make-rotate(135deg, 31%, -6%, null, null);
    }
    
    &--bottom {
      @include make-shape($border, $height * 1.2);
      animation: color-bottom 1s 3s forwards, dance-bottom 1s 4s alternate 6;
      background-color: $c-01;
      position: absolute;
      // Firefox Fix: Jagged Edges
      transform-style: preserve-3d;
      outline: 1px solid transparent;
      
      &:first-child {
        @include make-rotate(20deg, null, null, 6%, 2%);
      }
      
      &:nth-child(2) {
        @include make-rotate(5deg, null, null, -2%, 33%);
      }
      
      &:nth-child(3) {
        @include make-rotate(-5deg, null, 33%, -2%, null);
      }
      
      &:last-child {
        @include make-rotate(-20deg, null, 2%, 6%, null);
      }
    }
  }
    
  &__contour {
    @include make-shape($eye_width, $height + $border_2x);
    @include center-hztl($eye_width);
    overflow: hidden;
    top: 16%;
    
    &:before,
    &:after {
      @include make-shape($width, $height);
      @include half-shape($c-01);
      content: '';
      display: block;
      margin-left: -$overflow;
    }
    
    &:before {
      transform: rotateX(180deg);   
    }
    
    &:after {
      transform: translateY(-$height);      
    }
  }
  
  &__ball {
    @include make-shape($eye__ball);
    @include center-hztl($eye__ball);
    animation: color-eyeball 2s 1s forwards;
    border: $border solid $c-01;
    top: 0;
  }
  
  &__pupil {
    @include make-shape($eye__pupil, $eye__pupil * 2);
    @include center-hztl($eye__pupil);
    background-color: $c-01;
    margin-top: -(($eye__pupil * 2) / 2);
    top: 50%;
  }
}

@keyframes color-eyeball {
  100% {
    background-color: $c-03;
  }
}

@keyframes color-eyelashes {
  100% {
    background-color: $c-04;
  }
}

@keyframes color-bottom {
  100% {
    background-color: $c-05;
  }
}

@keyframes dance-bottom {
  100% {
    bottom: 0;
  }
}
            
          
!
            
              /* 
 * PURE CSS EYE
 * Original Pen illustration:
 * https://codepen.io/ilithya/pen/EWLjxx
 * By ilithya | 2017
 */
            
          
!
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