123

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.

            
              <div class="canvas"><svg
  class="burger"
   id="burger"
   viewBox="0 0 181 146"
   preserveAspectRatio="xMinYMin">
  <g
     transform="translate(-9,-26)"
     style="display:inline;opacity:0.98000004"
     >
    <path

       d="m 167,138 -4,9 -10,10 -18,11 -34,4 -31,-3 -24,-10 -12,-12 -7,-17 -1,-3 26,14 31,3 36,0 29,-6 22,-12 z"
       style="fill:#c87137;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path

       d="m 170,126 -22,12 -29,6 -18,28 34,-4 18,-11 10,-10 4,-9 z"
       style="fill:#ff9955;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  </g>
  <g
     transform="translate(-9,-26)"
     >
    <path

       d="m 19,102 -5,1 -5,6 6,5 6,1 4,8 -6,1 2,8 15,11 1,4 4,-2 1,-3 9,1 6,3 4,6 7,5 3,-1 5,3 3,4 11,1 7,-5 0,-5 5,-3 5,5 5,-2 2,-5 9,2 7,-1 4,-4 6,-2 5,-1 6,-4 8,4 6,-4 -1,-2 11,-3 -1,-8 9,-4 5,-1 2,-9 -7,3 -9,-6 -12,15 -23,1 -93,0 -24,-22 z"
       style="fill:#aad400;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path

       d="m 174,109 -12,15 -23,1 -24.31055,0 L 65.539062,155.24219 68,157 l 3,-1 5,3 3,4 11,1 7,-5 0,-5 5,-3 5,5 5,-2 2,-5 9,2 7,-1 4,-4 6,-2 5,-1 6,-4 8,4 6,-4 -1,-2 11,-3 -1,-8 9,-4 5,-1 2,-9 -7,3 -9,-6 z"
       style="fill:#e5ff80;fill-opacity:1;stroke:none" />
  </g>
  <g
     transform="translate(-9,-26)"
     >
    <path

       d="m 23,109 0,14 19,14 53,10 52,-7 25,-14 3,-19 -42,17 -42,3 -42,-7 z"
       style="fill:#502d16;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path

       d="m 175,107 -42,17 -16.72461,1.19531 L 88.501953,145.77344 95,147 l 52,-7 25,-14 3,-19 z"
       style="fill:#784421;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  </g>
  <g
     transform="translate(-9,-26)"
     >
    <path

       d="m 21,103 -5,6 11,35 9,-19 16,5 8,3 0,12 25,14 16,-12 -14,-4 0,-9 23,-9 14,7 15,-8 33,-12 2,-10 -56,15 -69,-2 z"
       style="fill:#ffcc00;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path

       d="m 174,102 -56,15 -7.53516,-0.21875 L 90.652344,132.57031 110,125 l 14,7 15,-8 33,-12 2,-10 z M 87,135.48242 68.841797,149.95117 85,159 l 16,-12 -14,-4 0,-7.51758 z"
       style="fill:#ffdd55;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  </g>
  <g
     transform="translate(-9,-26)"
     style="display:inline"
     >
    <path
       d="m 27,83 -6,1 -6,8 8,17 35,14 31,-4 39,3 36,-3 11,-12 1,-20 -5,-7 -4,0 -31,16 -48,3 -40,-2 z"
       style="fill:#d40000;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path

       d="M 167,80 136,96 100.82031,98.199219 67.845703,121.73047 89,119 l 39,3 36,-3 11,-12 1,-20 -5,-7 -4,0 z"
       style="fill:#ff0000;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  </g>
  <g
     transform="translate(-9,-26)"
     >
    <path

       d="m 22,79 0,9 13,11 28,10 29,3 46,-2 28,-11 4,-15 L 164,62 146,40 117,27 92,26 67,30 44,42 30,57 Z"
       style="fill:#c87137;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path

       d="M 125.79688,30.943359 68.292969,109.54688 92,112 l 46,-2 28,-11 4,-15 -6,-22 -18,-22 -20.20312,-9.056641 z"
       style="fill:#ff9955;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  </g>
</svg>

</div>
<div class="visitors">
  <svg
   class="person person--cowboy"
   viewBox="0 0 100 130"
   preserveAspectRatio="xMinYMin">
  <g
     transform="translate(-2.4745831,-1.3664309)">
    <path
       d="M 53.78026,1.4948718 C 47.08582,2.4987334 36.581731,12.293948 36.581731,12.293948 l -1.799847,3.199721 c 0,0 0.85213,1.746912 0.599949,2.599775 -0.81541,2.757684 -6.199468,5.999492 -6.199468,5.999492 l -2.199814,7.599345 2.199814,4.59961 c 0,0 5.410067,1.722616 8.199296,2.199808 0.856708,0.14658 1.857275,-0.251809 2.599778,0.199985 1.406493,0.855825 2.599779,4.199642 2.599779,4.199642 l -0.799934,1.799848 -5.799501,7.599345 c 0,0 -11.248973,5.366202 -16.798567,8.199299 -1.009319,0.51527 -2.189486,0.807586 -2.999742,1.599866 -2.624882,2.566657 -4.026556,6.194383 -5.399536,9.599179 -3.2712995,8.112338 -6.5994374,25.397833 -6.5994374,25.397833 0,0 -1.522633,9.302794 -1.599864,13.998804 -0.040712,2.47422 0.00476,4.99745 0.5999483,7.39937 2.4420847,9.85543 11.9989761,27.99759 11.9989761,27.99759 l 9.399194,4.99958 2.399796,36.79685 25.997775,0 1.599865,-17.19853 3.599694,17.99846 21.59815,0 3.599692,-25.19783 -1.199896,-13.19889 3.599693,-9.59918 c 0,0 10.870918,-17.36534 12.798904,-27.19767 0.488106,-2.48921 -0.399962,-7.59934 -0.399962,-7.59934 L 96.176635,87.487507 c 0,0 -2.084745,-15.137315 -5.199554,-21.998109 C 90.028856,63.400806 88.734846,61.363903 86.97742,59.889875 81.997233,55.712764 74.52616,55.460039 69.378925,51.490593 67.581056,50.104107 64.979303,46.29104 64.979303,46.29104 c 0,0 1.968917,1.219734 2.999742,0.999911 1.061301,-0.226318 2.399795,-2.199807 2.399795,-2.199807 l -0.399967,-4.99958 c 0,0 -0.209908,-3.906005 0.59995,-5.599523 0.203357,-0.425231 0.95347,-0.530835 0.999914,-0.999911 0.142098,-1.435078 -2.399793,-3.599687 -2.399793,-3.599687 0,0 1.406707,-2.576791 1.599863,-3.999658 0.0812,-0.598156 -0.199984,-1.799849 -0.199984,-1.799849 l 10.599091,-8.199299 c 0,0 -1.284366,-1.71264 -2.199809,-2.199808 -2.458226,-1.308192 -8.199298,-1.599866 -8.199298,-1.599866 l -3.39971,0.399969 -5.199553,-9.5991791 -3.199729,0 c 0,0 -3.424501,-1.6660617 -5.199555,-1.3998811 z"
       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.19797297px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  </g>
</svg>
  <svg
   class="person person--left"
   viewBox="0 0 42 50"
   preserveAspectRatio="xMinYMin">
  <g
     transform="translate(-32.042077,-37.595703)">
    <path
       d="m 49.21465,37.994162 -1.968556,0.705057 c 0,0 -1.792311,0.714977 -2.41211,1.410156 -0.224836,0.252181 -0.304021,0.606342 -0.408203,0.927734 -0.199006,0.613918 -0.204802,1.280103 -0.408203,1.892579 -0.253145,0.762265 -0.765574,1.423776 -1.001953,2.191406 -0.173559,0.563625 -0.335152,1.155642 -0.296875,1.74414 0.04368,0.671571 0.358567,1.29913 0.59375,1.929688 0.160642,0.430701 0.556641,1.261719 0.556641,1.261719 l -1.150391,4.527343 -1.818359,2.931641 -3.228516,3.787109 c 0,0 -1.462332,1.505578 -1.966797,2.41211 -0.776088,1.394643 -1.134721,2.98862 -1.558594,4.527344 -0.610995,2.218003 -1.099845,4.476529 -1.412109,6.755859 -0.27498,2.00718 -0.402344,6.064453 -0.402344,6.064453 0,0 -0.20572,2.693845 0.316407,3.882812 0.766533,1.745518 2.262932,3.194035 3.882812,4.199219 0.52706,0.327056 1.785156,0.525391 1.785156,0.525391 l 1.259766,0.839844 -1.994141,6.404296 -0.466797,5.400388 2.523438,10.39258 0.148437,3.11719 22.306641,-0.18555 0.222656,-7.27539 -0.111328,-6.27148 -1.523437,-12.099612 2.339843,-2.078126 0.07422,-3.490234 -0.964844,-3.5625 c 0,0 -1.508064,-6.190053 0.222657,-8.386719 0.650044,-0.825049 3.042968,-0.818359 3.042968,-0.818359 l 8.238282,-4.453125 c 0,0 0.962209,-1.668162 1.041015,-2.597656 0.05986,-0.706037 -0.120876,-1.449204 -0.447265,-2.078125 -0.80645,-1.553953 -3.5625,-3.859375 -3.5625,-3.859375 0,0 -1.870566,-6.841164 -4.75,-7.423828 -0.941627,-0.190542 -2.375,1.632812 -2.375,1.632812 L 61.908203,52.134766 59.382812,47.533203 57.15625,45.455078 c 0,0 0.258897,-2.67569 -0.668065,-4.158203 -1.297758,-2.075535 -5.120997,-3.451172 -5.120997,-3.451172 z m 6.011912,15.921854 4.007813,1.484375 -0.148437,2.226562 -4.75,-0.296875 z"
       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
  </g>
</svg>

</div>
            
          
!
            
              *
  box-sizing border-box


body
  background radial-gradient(#fff 25%, #111)
  height 100vh
  width 100vw
  display flex
  align-items center
  justify-content center
  flex-direction column
  padding 0
  margin 0

  &:after
    content ''
    position fixed
    top 0
    right 0
    bottom 0
    left 0
    background-color rgba(0, 0, 0, 0.95)
    animation lightsOn .5s 2s
    animation-fill-mode forwards

.canvas
  background #fafafa
  width 300px
  padding 40px
  box-shadow 4px 4px 10px rgba(0, 0, 0, 0.5)

.burger
  width 100%

.visitors
  position absolute
  bottom 0
  width 100%
  max-width 700px

.person
  width 200px
  position absolute
  left 0
  bottom 0
  visibility hidden

  &--left
    left 100px

@keyframes lightsOn
  to
    background-color rgba(0, 0, 0, 0)
            
          
!
            
              const awayBounds = [1, 2]
const transitionBounds = [5, 10]
const getTime = (bounds) => Math.floor(Math.random() * bounds[1] + bounds[0])
const animate = target => {
  const awayDelay = getTime(awayBounds)
  const transition = getTime(transitionBounds)
  const dim = target.getBoundingClientRect()
  const distance = -(dim.x + dim.width)
  const personTl = new TimelineLite({
    delay: awayDelay,
    onStart: () => target.style.visibility = 'visible'
  })
  personTl
    .add(
      TweenMax.from(target, transition, {
        x: distance,
      })
    )
}

const visitors = document.querySelectorAll('.person')
const init = () => {
  visitors.forEach(person => animate(person))
}
setTimeout(init, 2500)

            
          
!
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.

Console