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

              
                <div class="fox">
  <div class="leg-outer">
    <div class="leg">
      <div class="paw">
        <div class="log">
          <div class="log-inner">
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="leg-outer">
    <div class="leg">
      <div class="paw">
        <div class="log">
          <div class="log-inner"></div>
        </div>
      </div>
    </div>
  </div>
  <div class="hind-leg-outer">
    <div class="hind-leg-outer2">
      <div class="hind-paw">
        <div class="hind-log">
          <div class="hind-log-inner">
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="hind-leg-outer">
    <div class="hind-leg-outer2">
      <div class="hind-paw">
        <div class="hind-log">
          <div class="hind-log-inner">
          </div>
        </div>
      </div>
    </div>
  </div>
    <div class="body">
    <div class="head">
      <div class="ears">
        <div class="ear"></div>
        <div class="ear"></div>
      </div>
      <div class="face"></div>
      <div class="snout"></div>
    </div>
    <div class="tail">
      <div class="tail">
        <div class="tail">
          <div class="tail">
            <div class="tail">
              <div class="tail">
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="tail2">
        <div class="tail">
          <div class="tail">
            <div class="tail">
              <div class="tail">
                <div class="tail">
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="snow"></div>
              
            
!

CSS

              
                @import 'compass';
$color-fox: #E2DEE8;
$color-fox-dark: #C7C3D0;
$color-white: #F0E9EC;
$color-bg: #9095B9;
$fox-width: 470px;
$fox-height: 335px;

$duration: 0.9s;
$delay-hind: -$duration / 4;
$easing: cubic-bezier(0.445, 0, 0.55, 1);

.fox {
  width: $fox-width;
  height: $fox-height;
  min-width: $fox-width;
  min-height: $fox-height;
  
  * {
    position: absolute;
  }
  
  &:after {
    content: '';
    display: block;
    position: absolute;
    width: 80%;
    height: 20px;
    border-radius: 100%;
    background: rgba(black, 0.2);
    bottom: -10px;
    left: 10%;
    z-index: -1;
  }
}

$kfs: (
  -30 15   -20 50,
  25 -15   15 30,
); 

$anims: log, log-inner, hind-log, hind-log-inner;
$a-len: length($anims);
$k-len: length($kfs);
@function a($name) {
  @return unquote('#{$name} #{$duration} #{$easing} both infinite');
}

@for $a from 1 through $a-len {
  @keyframes #{nth($anims, $a)} {    
    @for $i from 1 through $k-len {
      $val: nth(nth($kfs, $i), $a);
      @if ($val != x) {        
        $rot: $val * 1deg;
        $p: if($i == 1, unquote('from, to'), percentage(($i - 1) / ($k-len )));

        #{$p} {
          transform: rotate($rot);
        }
      }
    }
  }
}

.leg-outer {
  bottom: 0;
  right: 127px;
  animation: a(leg-outer);
  z-index: 1;
  
  @keyframes leg-outer {
    0%, 100% {
      transform: translateX(0);
    }
    50% {
      transform: translateX(-76px);
    }
  }
}
.hind-leg-outer {
  bottom: 0;
  right: 263px;
  animation: a(leg-outer);
  animation-delay: $delay-hind;
  z-index: 1;
}

.leg {
  bottom: 0;
  animation: a(leg);
  
  @keyframes leg {
    75% {
      transform: translateY(-20px);
    }
    from, 40%, to {
      transform: translateY(0);
    }
  }
}
.hind-leg-outer2 {
  bottom: 0;
  animation: a(leg);
  animation-delay: $delay-hind;
}

.paw, .hind-paw {
  bottom: 100%;
  width: 10px;
  height: 12px;
  transform-origin: bottom center;
  border-radius: 5px;
  background: #000;
  
  &:after {
    animation: a(paw);
    content: '';
    position: absolute;
    display: block;
    left: 0;
    bottom: 0;
    height: 100%;
    width: 200%;
    background: #000;
    border-radius: 100px;
    transform-origin: 5px center;
  }
  
  @keyframes paw {
    10%, to {
      transform: rotate(10deg);
    }
    20%, 40% {
      transform: rotate(10deg);
    }
    70% {
      transform: rotate(120deg);
    }
  }
}
.hind-paw {
  animation-delay: $delay-hind;
}

.log, .hind-log {
  bottom: calc(100% - 5px);
  width: 10px;
  height: 44px;
  transform-origin: bottom center;
  transform: rotate(5deg);
  background: black;
  border-bottom-right-radius: 50% 100%;
  border-top-right-radius: 5px;
  border-top-left-radius: 5px;
  
  &:after {
    content: '';
    display: block;
    position: absolute;
    height: 100%;
    width: 75%;
    right: 0;
    background: black;
    transform-origin: right bottom;
    transform: rotate(9deg);
    border-top-right-radius: 8px;
  }
}
.log {
  animation: a(log);
}
.hind-log {
  animation: a(hind-log);
  animation-delay: $delay-hind;
}

.log-inner, .hind-log-inner {
  z-index: 1;
}
.log-inner {
  bottom: calc(100% - 8px);
  width: 15px;
  height: 65px;
  transform-origin: bottom center;
  animation: a(log-inner);
  background-color: $color-fox;
  background-image: linear-gradient(to top,
    black,
    black 10px,
    transparent 11px,
    transparent
  );
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
  
  .leg-outer + .leg-outer & {
    &, &:after {
      background-color: $color-fox-dark;
    }
    
    &:before {
      background: radial-gradient(farthest-side at bottom left,
        transparent,
        transparent 99%,
        $color-fox-dark);
    }
  }
  
  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
  }
  &:before {
    right: 100%;
    background: radial-gradient(farthest-side at bottom left,
      transparent,
      transparent 99%,
      $color-fox);
    height: 90%;
    bottom: 0;
    width: 240%;
    border-top-left-radius: 100%;
  }
  &:after {
    right: 0;
    bottom: 0;
    height: 100%;
    width: 100%;
    background-color: $color-fox;
    transform-origin: bottom right;
    transform: rotate(15deg);
    border-bottom-left-radius: 50% 100%;
    border-bottom-right-radius: 5px;
    background-image: linear-gradient(-15deg,
      black,
      black 9.5px,
      transparent 9.5px,
      transparent
    );
  }
}
.hind-log-inner {
  bottom: calc(100% - 7px);
  width: 15px;
  left: -1px;
  height: 80px;
  transform-origin: bottom center;
  animation: a(hind-log-inner);
  animation-delay: $delay-hind;
  background-color: $color-fox;
  background-image: linear-gradient(to top,
    black,
    black 12px,
    transparent 12px,
    transparent);
  
  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
  }
  &:before {
    right: 100%;
    background: radial-gradient(farthest-side at bottom left,
      transparent,
      transparent 99%,
      $color-fox);
    height: 90%;
    bottom: 0;
    width: 240%;
    border-top-left-radius: 100%;
  }
  &:after {
    left: 100%;
    left: 100%;
    height: 100%;
    width: 34px;
    background-color: $color-fox;
    border-bottom-right-radius: 100% 100%;
    transform-origin: bottom left;
    transform: skewY(-38deg);
    background-image: linear-gradient(38deg,
      black,
      black 10px,
      transparent 10px,
      transparent);
  }
  
  .hind-leg-outer + .hind-leg-outer &:before {
    background: radial-gradient(farthest-side at bottom left,
      transparent,
      transparent 99%,
      $color-fox-dark);
  }
}

.leg-outer + .leg-outer {
  z-index: 0;
  
  &, *, *:after {
    animation-delay: -$duration / 2 !important;
  }
}

.hind-paw:after {
  animation-delay: -$duration / 2 - $delay-hind;
}

.hind-leg-outer + .hind-leg-outer {
  z-index: 0;
  
  &, *, *:after {
    animation-delay: -$duration / 2 + $delay-hind;
  }
  
  .hind-log-inner {
    &, &:after {
      background-color: $color-fox-dark;
    }
  }
}

.body {
  top: 50%;
  left: 170px;
  height: 90px;
  width: 173px;
  background: $color-fox;
  border-top-left-radius: 25% 50%;
  border-bottom-left-radius: 25% 50%;
  // border-top-right-radius: 25% 50%;
  border-bottom-right-radius: 25% 50%;
  transform-origin: right center;
  animation: a(body);
  animation-duration: $duration / 2;
  animation-delay: $delay-hind;

  @keyframes body {
    from, to {
      transform: rotate(-1deg);
    }
    50% {
      transform: rotate(1deg);
    }
  }
  
  &:before {
    content: '';
    display: block;
    position: absolute;
    height: 50px;
    width: 50px;
    background: $color-fox;
    z-index: 1;
    border-top-right-radius: 10px;
    right: 3px;
    top: -3px;
    transform: rotate(15deg);
  }
}

.head {
  position: absolute;
  height: 87px;
  width: 112px;
  bottom: 89%;
  left: 65%;
  border-top-left-radius: 40% 60%;
  border-top-right-radius: 60% 20%;
  background: $color-fox;
  animation: a(head);
  animation-duration: $duration / 2;
  animation-delay: $delay-hind;
  transform-origin: center bottom;
  z-index: 0;
  transform-style: preserve-3d;
  
  @keyframes head {
    from, to {
      transform: rotate(0);
    }
    50% {
      transform: translateY(2px) rotate(-2deg);
    }
  }
  
  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
  }
  
  &:before {
    width: 15px;
    height: 15px;
    right: 100%;
    bottom: 9px;
    background-image: radial-gradient(
      ellipse farthest-side at top left,
      transparent,
      transparent 99%,
      $color-fox 99.1%
    );
  }
  
  &:after {
    width: 50px;
    height: 40px;
    top: calc(100% - 1px);
    left: 50%;
    background-image: radial-gradient(
      ellipse farthest-side at bottom right,
      transparent,
      transparent 99%,
      $color-white 99.1%
    );
  }
}

.face {
  width: 84px;
  height: 72px;
  bottom: 0;
  right: 5px;
  background: $color-white;
  border-top-left-radius: 60% 100%;
  border-top-right-radius: 40% 10%;
  z-index: 2;
  animation: a(face);
  
  @keyframes face {
    from, to {
      transform: translateX(0);
    }
    50% {
      transform: translateX(-2px);
    }
  }
  
  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
    background: black;
    animation: a(eye);
    
    @keyframes eye {
      from, to {
        transform: rotate(-12deg);
      }
      50% {
        transform: translateX(-2px) rotate(-12deg);
      }
    }
  }
  
  &:before {
    height: 4px;
    width: 25px;
    border-radius: 2px;
    top: 13px;
    right: 10px;
  }
  
  &:after {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    top: 23px;
    right: 15px;
  }
}

.snout {
  width: 36px;
  height: 24px;
  left: calc(100% - 5px);
  bottom: 0;
  border-bottom-right-radius: 100%;
  background-color: $color-white;
  background-image: radial-gradient(circle 6px at top right, black, black 99%, transparent 99%);
  transform-origin: right;
  animation: a(snout);
  
  @keyframes snout {
    from, to {
      transform: scale(1);
    }
    50% {
      transform: scaleX(1.05);
    }
  }
  
  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
    bottom: 100%;
    left: 5px;
    width: calc(100% - 5px);
    height: 40px;
    background-image: radial-gradient(
      ellipse farthest-side at top right,
      transparent,
      transparent 99%,
      $color-fox 99.1%
    );
  }
  &:before {
    animation: a(snout-outer);
    
    @keyframes snout-outer {
      50% {
        transform: scaleX(0.93);
      }
    }
  }
  &:after {
    background-image: radial-gradient(
      ellipse farthest-side at top right,
      transparent,
      transparent 99%,
      $color-white 99.1%
    );
    left: 0;
  }
}

@mixin n-tail($n, $size: null, $prev: null, $rot: 0deg) {
  $selector: '.tail';
  $sep: ' > ';
  $result: '';
  
  $a: $size / 2;
  $b: $prev / 2;
  $t: sqrt(pow($a + $b, 2) - pow($b - $a, 2));
  $angle: acos($t/($a + $b)) * 180deg / 3.14159;
  $angle: if($size > $prev, $angle, -$angle);
  
  @for $i from 1 through $n - 1 {
    $result: $result + $sep + $selector;
  }
  
  #{unquote($result)} {
    @if ($size) {
      height: $size * 1px;
      width: $size * 1px;
      top: ($size - $prev) / 2 * -1px;
    }
    @content;
    transform-origin: calc(100% + #{$prev * 1px / 2});
    transform: rotate($rot);
    
    &:before, &:after {
      content: '';
      left: 50%;
      position: absolute;
      height: 50%;
      width: $t * 1px;
      display: block;
      background: $color-fox;
    }
    
    &:after {
      bottom: 0;
      transform-origin: top left;
      transform: rotate(-$angle);
    }
    &:before {
      transform-origin: bottom left;
      transform: rotate($angle);
    }
  }
}

.tail {
  border-radius: 50%;
  background: $color-fox;
  // border: 1px solid;
  width: 1rem;
  height: 1rem;
}

$tail1: (
  20 58deg 58deg,
  36 0 0,
  93 -30deg -24deg,
  98 -24deg -17deg,
  36 10deg 41deg,
  15 0deg 10deg,
);

$tail2: (
  20 18deg 18deg,
  70 -33deg -30deg,
  120 -35deg -30deg,
  50 5deg 27deg,
  20 0deg 23deg,
  10 3deg 10deg,
);

.body > .tail {
  $size: nth(nth($tail1, 1), 1);
  height: $size;
  width: $size;
  left: 10px;
  transform: rotate(nth(nth($tail1, 1), 2));
  
  .tail {
    right: 100%;
    border-color: green;
    z-index: -1;
  }
  
  @for $i from 2 through length($tail1) {
    
    @include n-tail($i,
      nth(nth($tail1, $i), 1),
      nth(nth($tail1, $i - 1), 1),
      nth(nth($tail1, $i), 3)
    ) {
      animation: a(tail-#{$i});
      animation-delay: if($i == 4, -200ms, 0) + $delay-hind;
    
      @if $i == 4 {
        background: $color-white !important;
        &:before {
          background: linear-gradient(to right, $color-white, $color-fox) !important;
        }
      }
      @if $i > 4 {
        &, &:before, &:after {
          background: $color-white !important;
        }
      }
      
      @keyframes tail-#{$i} {
        from, to {
          transform: rotate(nth(nth($tail1, $i), 2));
        }
        50% {
          transform: rotate(nth(nth($tail1, $i), 3));
        }
      }
    }
    
    > .tail2 {
      @include n-tail($i,
        nth(nth($tail2, $i), 1),
        nth(nth($tail2, $i - 1), 1),
        nth(nth($tail2, $i), 3)
      ) {
        animation: a(tail2-#{$i});
        animation-delay: if($i == 3, -200ms, 0) + $delay-hind;
        
        @if $i == 3 {
          $x: 90deg;
          background: 
            linear-gradient(45deg, $color-white 25%, transparent 25%),
            linear-gradient(135deg, $color-white 25%, transparent 25%) 0 0,
            linear-gradient(to left, transparent, transparent 66%, $color-white 66%);	
          background-size: 40px 40px, 40px 40px, 100%;
          background-position: center;
          background-color: $color-fox;
          background-repeat: repeat-y;
        }
        
        @if $i == 4 {
          &:before {
            display: none !important;
          }
        }
        
        @if $i >= 4 {
          &, &:before, &:after {
            background: $color-white !important;
          }
        }
      
        @keyframes tail2-#{$i} {
          from, to {
            transform: rotate(nth(nth($tail2, $i), 2));
          }
          50% {
            transform: rotate(nth(nth($tail2, $i), 3));
          }
        }
      }
    }
  }
  
  > .tail2 {
    height: nth(nth($tail2, 1), 1) * 1px;
    width: nth(nth($tail2, 1), 1) * 1px;
    border-radius: 50%;
    position: absolute;
    right: 50%;
    transform-origin: right center;
    transform: rotate(18deg);
    
    .tail {
      border-color: blue;
      z-index: -1;
    }
  }
}

.ears {
  top: 10px;
  left: 35px;
  width: 60px;
  transform: rotateY(20deg);
  transform-origin: bottom left;
  
  &:before {
    content: '';
    display: block;
    position: absolute;
    width: 60px;
    height: 40px;
    background: $color-fox;
    border-top-left-radius: 100%;
    left: -36px;
    top: -16px;
    transform: rotate(-18deg) skewX(-20deg);
  }
}

.ear {
  width: 40px;
  height: 46px;
  bottom: 0;
  transform: skewY(-10deg);
  transform-origin: right bottom;
  
  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
    height: 100%;
    width: 100%;
    border-top-left-radius: 100%;
  }
  &:before {
    background: $color-fox;
  }
  &:after {
    background: #D5D1DC;
    width: 60%;
    right: 0;
    animation: a(ear-inner);
    animation-delay: -$duration / 2;
    transform-origin: right;
    
    @keyframes ear-inner {
      50% {
        transform: scaleX(0.9);
      }
    }
  }
  
  &:nth-child(1) {
    right: 0;
    animation: a(ear-back);
    
    @keyframes ear-back {
      from, to { 
        transform: rotate(5deg) skewY(-10deg);
      }
      50% {
        transform: translateX(-1px) rotate(5deg) skewY(-10deg);
      }
    }
  }
  &:nth-child(2) {
    left: 0;
    transform: skewY(-10deg);
  }
}

.snow {
  $snow-color: rgba(white, 0.8);
  $num-snowflakes: 40;
  position: absolute;
  top: 0;
  left: 0;
  width: 120%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s $easing;
  animation: snow-x $easing 4s both alternate infinite;
  
  @keyframes snow-x {
    from {
      transform: translateX(-10%);
    }
    to {
      transform: translateX(10%);
    }
  }
  
  .fox:hover + & {
    opacity: 1;
  }

  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;  
    z-index: 10;
    width: 1vmin;
    height: 1vmin;
    background-color: $snow-color;
    border-radius: 50%;
    animation: snow 7s linear infinite;

    $snowflakes: ();

    @for $i from 1 through $num-snowflakes {
      $top: random() * 100vh * 3;
      $left: random() * 100vw;

      $snowflakes: append($snowflakes,
        #{$left $top $snow-color},
        comma
      );

      $snowflakes: append($snowflakes,
        #{$left $top + 100vh * 3 $snow-color},
        comma
      );
    }

    box-shadow: $snowflakes;
  }

  &:after {
    width: 1.1vmin;
    height: 8px;
    animation-duration: 6s;
  }

  @keyframes snow {
    from {
      transform: rotate(10deg)
        translateY(-300vh);
    }
    to {
      transform: rotate(10deg)
        translateY(0);
    }
  }
}

body {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  background: $color-bg;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

*, *:before, *:after {
  box-sizing: border-box;
  position: relative;
}
              
            
!

JS

              
                /* hover for ❄️ happy holidays! */
              
            
!
999px

Console