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="wrapper">
  <div class="illu">
  
  <div class="besen">
    <div class="besen__start"></div>
    <div class="besen__end"></div>
  </div>
  
  <div class="body"></div>
  
  <div class="leg">
    <div class="leg__top"></div>
    <div class="leg__down">
      <div class="foot"></div>
    </div>
  </div>
  
  <div class="arm">
    <div class="arm__top"></div>
    <div class="arm__down"></div>
  </div>

  <div class="cap">
    <div class="cap__main"></div>
    <div class="cap__end"></div>
  </div>
 
  <div class="face--profil">
    <div class="nose"></div>
    <div class="base">
      <div class="hair hair--right"></div>
      <div class="hair hair--left"></div>
      <div class="mouth"></div>  
      <div class="glases face--side"></div>
      <div class="eye eye--right"></div>
    </div>
  </div>
  
</div>

<div class="wind wind--1"></div>
<div class="wind wind--2"></div>
  
<div class="schnatz">
  <div class="kugel"></div>
  <div class="wing wing--left"></div>
  <div class="wing wing--right"></div>
</div>
              
            
!

CSS

              
                @mixin pseudo{
  position: absolute;
  display: block;
  content:"";
}

$darkbrown:#7A4B2C;
$brown:#FAD08A;
$red:#C02E1A;
$bg:orange;
$white:#e5e5e5;
$brownmiddle:#B9832A;
$black:#49301B;



body{
  background-color: $bg;
  overflow:hidden; 
  height:100vh;
}
.wrapper{
  height:100vh;
  overflow:hidden; 
  display:flex;
  align-items: center;
  justify-content: center;
}

.illu{
  position: relative;
  width:60vw;
  height:19vw;
  animation:fly 2s linear infinite alternate;
  transform-origin:left 30% center;
  @keyframes fly{
    0%{
      transform:rotate(-5deg);
    }
    100%{
      transform:rotate(0deg);
    }
  }
}

.besen {
  position: absolute;
  transform:rotate(-1deg);
  bottom:7vw;
  .besen__start{
    top:3vw;
    position: absolute;
    width:62vw;
    height:2vw;
    background-color: $darkbrown;
    border-radius:30px;
  }
  .besen__end{
    position: absolute;
    background-color: $brown;
    width:20vw;
    height:8vw;
    border-top-right-radius:100px;
    border-bottom-right-radius:100px;
    &:after{
      @include pseudo;
      background-color: $red;
      width:1.5vw;
      height:8vw;
      left:14vw
    }
     &:before{
      @include pseudo;
      width: 0; 
      height: 0; 
      bottom:2vw;
      border-top: 1.5vw solid transparent;
      border-left: 3vw solid $bg;
    }
  }
}

.cap{
  position: relative;
  left:10vw;
  top:-1vw;
  .cap__main{
    position: absolute;
    background-color: $red;
    width:30vw;
    height:15vw;
    border-top-right-radius:2vw;
    border-bottom-left-radius:2vw;
    border-bottom-right-radius:100%;
    animation:cap 1s linear infinite alternate;
    @keyframes cap{
      from{
        border-bottom-left-radius:2vw;
        border-bottom-right-radius:100%;
      }
      to{
        border-bottom-left-radius:6vw;
        border-bottom-right-radius:75%;
      }
    }
  }
  .cap__end{
    position: absolute;
    background-color: $red;
    border-bottom-left-radius:4vw;
    width:8vw;
    left:-8vw;
    height:4vw;
    top:0;
    animation:cap_end 1s linear infinite alternate;
    @keyframes cap_end{
      from{
        border-top-left-radius:2vw;
        border-bottom-left-radius:2vw;
      }
      to{
        border-top-left-radius:1.5vw;
        border-bottom-left-radius:1.5vw;
      }
    }
    &:before{
      @include pseudo;
      background-color: $red;
      height:4vw;
      width:4vw;
      top:4vw;
      left:4vw;
    }
    &:after{
      @include pseudo;
      background-color: $bg;
      height:4vw;
      width:4vw;
      top:4vw;
      left:4vw;
      border-top-right-radius:5vw;
    }
  }
}

.body{
  position: absolute;
  background-color: $brownmiddle;
  top:2vw;
  left:21vw;
  width:21vw;
  height:12vw;
  border-top-right-radius:1vw;
  border-bottom-right-radius:100%;
}

.arm{
  left:37vw;
  transform-origin:left center;
  top:2vw;
  position: absolute;
  animation:arm 2s linear infinite alternate;
  @keyframes arm{
    0%{
      transform:rotate(40deg);
    }
    100%{
      transform:rotate(45deg);
    }
  }
  .arm__top{
    position: absolute;
    background-color: #C6512E;
    border-radius:40%;
    width:15vw;
    height:4vw;
  }
  .arm__down{
    position: absolute;
    left:3vw;
    bottom:-7vw;
    transform-origin:right top;
    background-color:#C6512E;
    border-radius:40%;
    width:10vw;
    height:3vw;
    overflow:hidden;
    animation:arm_down 2s linear infinite alternate;
    @keyframes arm_down{
      0%{
        transform:rotate(150deg);
      }
      100%{
        transform:rotate(142deg);
      }
    }
    &:before{
      @include pseudo;
      right:0;
      background-color:#C6512E;
      height:100%;
      width:70%;
    }
    &:after{
      @include pseudo;
      background-color: beige;
      position: absolute;
      left:0;
      height:100%;
      width:3vw;
    }
  }
}

.face--side{
  left:35vw;
  top:-7vw;
  position: relative;
  animation:face 2s -2s linear infinite alternate;
  @keyframes face{
    0%{
      transform:rotate(3deg);
    }
    100%{
      transform:rotate(0deg);
    }
  }
  .hair__bg{
    position: absolute;
    background-color: $black;
    width:12vw;
    left:-1vw;
    top:-1vw;
    height:8vw;
    border-radius:5vw;
    border-bottom-left-radius:1vw;
    border-bottom-right-radius:1vw;
  }
  .base{
    width:10vw;
    height:11.5vw;
    background-color: beige;
    border-radius:3vw;
    border-bottom-left-radius:6vw;
    border-bottom-right-radius:6vw;
    position: relative;
    .eye{
      background-color: #000;
      height:1vw;
      width:1vw;
      position: absolute;
      border-radius:50%;
      top:5.5vw;
      &.eye--right{
        right:2vw;
      }
      &.eye--left{
        left:2vw;
      }
    }
    .glases{
      top:5.7vw;
      left:calc(50% - 0.5vw);
      position: absolute;
      width:1.5vw;
      height:0.6vw;
      background-color: black;
      &:after, &:before{
        @include pseudo;
        position: absolute;
        width:3vw;
        height:3vw;
        border-radius:50%;
        border:solid 0.6vw black;
        top:-1.75vw;
      }
      &:after{
        left:-4vw;
         z-index:3;
      }
      &:before{
        left:1vw;
      }
    }
    .mouth{
      background-color: $red;
      width:3vw;
      height:1vw;
      position: absolute;
      top:9vw;
      left:calc(50% - 1.5vw);
      border-radius: 50% / 100%;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
    .hair{
      background-color: $black;
      position: absolute;
      width:52%;
      height:5vw;
      &.hair--right{
        left:0;
        width:80%;
        border-top-left-radius:2vw;
        border-bottom-right-radius:100%;
      }
      &.hair--left{
        right:0;
        height:5.5vw;
        width:40%;
        border-top-right-radius:2vw;
        border-bottom-left-radius:100%;
      }
    }
  }
}


.face--profil{
  left:37vw;
  top:-8vw;
  position: relative;
  animation:face 2s -2s linear infinite alternate;
  @keyframes face{
    0%{
      transform:rotate(3deg);
    }
    100%{
      transform:rotate(0deg);
    }
  }
  .nose{
    position: absolute;
    left:9vw;
    z-index: 1;
    top:6.3vw;
    width:1.5vw;
    height:1.5vw;
    background-color:beige;
    z-index: 5;
    border-radius:50%;
  }
  .base{
    width:10vw;
    height:11.5vw;
    background-color: beige;
    border-radius:3vw;
    border-bottom-left-radius:6vw;
    border-bottom-right-radius:6vw;
    position: relative;
    overflow:hidden;
    .eye{
      background-color: #000;
      height:1vw;
      width:1vw;
      position: absolute;
      border-radius:50%;
      top:5.5vw;
      &.eye--right{
        right:2vw;
      }
    }
    .glases{
      top:5.7vw;
      left:9vw;
      position: absolute;
      width:1.5vw;
      height:0.6vw;
      background-color: black;
      &:after{
        @include pseudo;
        position: absolute;
        width:3vw;
        height:3vw;
        border-radius:50%;
        border:solid 0.6vw black;
        top:-1.75vw;
        left:-3.8vw;
        z-index:3;
      }
    }
    .mouth{
      background-color: $red;
      width:3vw;
      height:1vw;
      position: absolute;
      top:9vw;
      right:0;
      border-radius: 50% / 100%;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
    .hair{
      background-color: $black;
      position: absolute;
      width:52%;
      height:5vw;
      &.hair--right{
        left:0;
        width:40%;
        height:10vw;
        border-top-left-radius:2vw;
        border-bottom-right-radius:5vw;
      }
      &.hair--left{
        right:0;
        height:3vw;
        width:100%;
        border-top-right-radius:2vw;
        border-bottom-right-radius:10%;
        &:before{  
          @include  pseudo;
          height:2vw;
          width:2vw;
          position: absolute;
          background-color: $black;
          top:3vw;
          left:4vw;
        }
        &:after{  
          @include  pseudo;
          height:4vw;
          width:4vw;
          background-color: beige;
          top:3vw;
          left:4vw;
          border-radius:50%;
        }
      }
    }
  }
}

.leg{
  position: relative;
  left:20vw;
  top:9vw;
  width:22vw;
  transform-origin:left top;
  animation:leg 2s -2s linear infinite alternate;
  @keyframes leg{
    0%{
      transform:rotate(7deg);
    }
    100%{
      transform:rotate(0deg);
    }
  }
  .leg__top{
    position: absolute;
    width:22vw;
    height:6vw;
    background-color:#C6512E;
    border-radius:40%;
  }
  .leg__down{
    right:0;
    transform-origin:right center;
    transform:rotate(-35deg);
    position: absolute;
    width:18vw;
    height:5vw;
    background-color:#C6512E;
    border-radius:40%;
  }
  
  .foot{
    position: absolute;
    background-color: $black;
    width:2vw;
    height:6vw;
    top:1vw;
    left:-1vw;
    transform-origin:left top;
    border-bottom-right-radius:80vw;
    animation:foot 2s linear infinite alternate;
    @keyframes foot{
      0%{
        transform:rotate(0deg);
      }
      100%{
        transform:rotate(20deg);
      }
    }
  }
}


.wind{
  animation:wind 1.5s linear infinite;
  background-color:$white;
  border-radius:40px;
  height:1.5vh;
  position: absolute;
  &:after{
    @include pseudo;
    position: absolute;
    height:1.5vh;
    background-color:$white;
    border-radius:40px;
    top:4vw;
    left:8vw;
  }
  @keyframes wind{
    from{transform:translateX(100vw)}
    to{transform:translateX(-100vw)}
  }
}

.wind--1{
  top:10vh;
  width:30vw;
  &:after{
    width:30vw;
  }
}

.wind--2{
  bottom:25vh;
  width:50vw;
  animation-delay:-0.5s;
  &:after{
    width:50vw;
  }
}

.schnatz{
  position: absolute;
  transition-timing-function:ease-in-out;
  .kugel{
    width:3vw;
    height:3vw;
    background-color: gold;
    border-radius:50%;
    position: absolute;
  }
  .wing{
    position: absolute;
    width:6vw;
    height:1.5vw;
    border-radius:20px;
    background-color: gold;
    top:-2vw;
    &:after{
      @include pseudo;
      position: absolute;
      width:4vw;
      height:1.5vw;
      top:1vw;
      background-color: gold;
      border-radius:20px;
      
    }
    &.wing--left{
      left:-6vw;
      transform-origin:right bottom;
      animation:wing--left 1s infinite alternate;
      @keyframes wing--left{
        from{transform:rotate(30deg)}
        to{transform:rotate(0deg)}
      }
      &:after{
        left:2vw;
      }
    }
    &.wing--right{
      left:3vw;
      transform-origin:left bottom;
      animation:wing--right 1s infinite alternate;
      @keyframes wing--right{
        from{transform:rotate(-30deg)}
        to{transform:rotate(0deg)}
      }
    }
  }
}

              
            
!

JS

              
                

var newq;
let h,w,nh,nw,s; 

function newPosition(){   
  h = window.innerHeight - 50;
  w = window.innerWidth - 50;
  nh = Math.floor(Math.random() * h);
  nw = Math.floor(Math.random() * w);
  return [nh,nw];       
}




window.setInterval(function(){
  var newq = newPosition();
  $(".schnatz" ).animate({
    top: newq[0],
    left: newq[1] 
    }, 1000, function() {
  });
}, 1000);




  




              
            
!
999px

Console