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

              
                <template>
  <div class="avocado">
    <svg viewBox="0 0 135 178">
      <g class="arms" fill="none" stroke="#000" stroke-linecap="round" stroke-width="4">
        <path d="M 30.971627,77.044969 C 1.8442515,59.644207 10.922912,43 10.922912,43"/>
        <path d="M 104.95126,77.044969 C 134.07865,59.644207 125,43 125,43"/>
      </g>
      <g class="feets" fill="none" stroke="#000" stroke-linecap="round" stroke-width="4">
        <path d="m 75.973727,140.56989 c 5.91069,24.01215 -1.10825,35.4641 -1.10825,35.4641 h 11.08253"/>
        <path d="m 54.886437,140.56989 c -5.91069,24.01215 1.10825,35.4641 1.10825,35.4641 h -11.08253"/>
      </g>
      <g class="body">
        <path class="d" fill="none" d="m 129.0419,111.78105 c -3.47383,6.01685 -56.212884,0 -63.160544,0 -6.947659,0 -59.6867121,6.01685 -63.1605421,0 C -0.75301594,105.7642 30.827254,63.099265 34.301084,57.082415 37.774914,51.065566 58.933696,2.3837816 65.881356,2.3837814 c 6.947659,-2e-7 28.10644,48.6817826 31.580269,54.6986326 3.473835,6.01685 35.054105,48.681786 31.580275,54.698636 z"/>        
        <path class="outer" fill="#2a670c" d="M65 5a40 54 0 0 0-40 54 40 54 0 0 0 0 9 50 50 0 0 0-9 30 50 50 0 0 0 49 49 50 50 0 0 0 50-49 50 50 0 0 0-10-30 40 54 0 0 0 1-9A40 54 0 0 0 65 5z"/>
        <path class="inner" fill="#c1e20c" d="M65 12a36 48 0 0 0-36 48 36 48 0 0 0 1 8 44 44 0 0 0-9 26 44 44 0 0 0 44 44 44 44 0 0 0 45-44 44 44 0 0 0-9-26 36 48 0 0 0 0-8 36 48 0 0 0-36-48z"/>
      </g>
      <g class="seed">
        <circle cx="66" cy="93" r="20" fill="#452c0c"/>
        <path fill="#FFF2" d="M107-65a15 15 0 0 1-7 13 15 15 0 0 1-15 0 15 15 0 0 1-7-13" transform="rotate(90)"/>
      </g>
      <g class="face">
        <g class="eye izq">
          <circle cx="58" cy="42" r="6"/>
          <circle cx="56" cy="41" r="3" fill="#fff"/>
        </g>
        <g class="eye der">
          <circle cx="73" cy="42" r="6"/>
          <circle cx="72" cy="41" r="3" fill="#fff"/>
        </g>
        <path d="M73 53a8 8 0 0 1-4 7 8 8 0 0 1-8 0 8 8 0 0 1-4-7"/>
      </g>
    </svg>
  </div>
</template>

<div class="grid"></div>
<div class="waves"></div>

<div class="data">
  <h1>Avocado</h1>
  <div class="music">🎵</div>  
  <h2>#Codevember</h2>
  <a class="ghost" href="https://twitter.com/Manz" target="_blank">Code by Manz</a>
  <a class="ghost" href="https://soundcloud.com/tomdalips/tom-da-lips-avocado-free-download" target="_blank">Music by Tom Da Lips</a>   
</div>

<iframe style="display:none" width="100%" height="300" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/324580306&amp;color=%23ff5500&amp;auto_play=true&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;show_teaser=true&amp;visual=true"></iframe>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Montserrat:400,600,800');

.data {
  position:relative;
  z-index:0;
  text-align:center;
  width:400px;
  margin:auto;
  padding:20px;
}

h1, h2, .ghost {
  font-family:Montserrat;
  font-weight:600;  
  margin:0;
}
  
h1 {
  font-weight:800;
  letter-spacing:-2px;
  font-size:64px;
  color:#444;
}

h2 {
  font-size:24px;
  color:#222;
}

.ghost {
  font-weight:400;
  font-size:15px;
  color:#000;
  display:inline-block;
  margin:8px 2px;
  padding:8px;
  border:1px solid #2a670c;
  text-decoration:none;
}

a.ghost:hover {
  transition:all .5s linear;
  background:rgba(50,50,50, .2);
  border-color:#000;
  color:#000;
}

body {
  background:#e4ff93;
  display:flex;
  justify-content:center;
  align-items:center;
  overflow:hidden;
  animation:ambient 4s ease alternate infinite;
}

@keyframes ambient {
  0% { background:#e4ff93 }
  50% { background:#888 }
  100% { background:#98ff93 }
}

.grid {
  display: grid;
  grid-template-columns: 30vw 30vw 30vw;
  justify-items:center;
  align-items:end;
  position:absolute;
  bottom:50px;
  pointer-events:none;  
  z-index:1;
}
.grid .avocado:nth-child(2) svg { width:250px; z-index:5 }

.avocado {
  border-bottom:1px solid #777;
  pointer-events:none;
}

.avocado .body,
.avocado .face,
.avocado .arms {
  transition:all .5s ease;  
}

.avocado svg {
  width:175px;
  transform-origin:50% 100%;
  animation:dancing .5s linear alternate infinite;
  position:relative;
  top:5px;
  pointer-events:none;
}

.avocado.super .d {
  transform:translateY(10px);
  fill:#b2132c;  
}

.avocado.back {
  transform-origin:50% 100%;
  animation:dancing .5s linear alternate infinite;  
}
.avocado.back .inner,
.avocado.back .seed,
.avocado.back .face {
  opacity:0;
}

.dorito .inner,
.dorito .outer,
.dorito .seed {
  opacity:0;
}
.dorito .body,
.dorito .arms,
.dorito .face {
  transform:translateY(35px);
}
.dorito .d {
  fill:#e3c02c;
}

@keyframes dancing {
  0% { transform:skew(-1deg) scaleY(1.025) scaleX(1) }
  50% { transform:skew(0) scaleY(.999) scaleX(1) }
  100% { transform:skew(1deg) scaleY(1.025) scaleX(1) }
}

@keyframes assdancing {
  0% { transform:skew(-2deg) scaleY(1.025) scaleX(.9) }
  50% { transform:skew(0) scaleY(.999) scaleX(1) }
  100% { transform:skew(2deg) scaleY(1.025) scaleX(1.1) }
}

.avocado .eye {
  animation:blink 4s steps(2) infinite;
}

@keyframes blink {
  0%, 49%, 52%, 100% { opacity:1 }
  50% { opacity:0 }
}

.music {
  position:absolute;
  top:15px;
  right:20px;
  color:#000;
  font-size:32px;
  animation:movenote .5s ease alternate infinite;
  z-index:10;
}

@keyframes movenote {
  0% { transform:translate(-10px, -5px) }
  50% { transform:translate(0, 0) }
  100% { transform:translate(10px, -5px) }
}

.waves {
  width:100vw;
  height:350px;
  position:absolute;
  bottom:52px;
  z-index:-1;
  display:flex;
  justify-content:center;
  align-items:flex-end;
}

.bar {
  width:10vw;
  height:100%;
  background:#FFF;
  margin:0 5px;
  transition:height .15s ease;
}
              
            
!

JS

              
                let avocado = document.querySelector('template');
let grid = document.querySelector('.grid');
let waves = document.querySelector('.waves');
let options = ['avocado', 'avocado back', 'super avocado', 'avocado dorito'];

for (let i = 0; i < 3; i++)
  grid.appendChild(avocado.content.cloneNode(true));

for (let i = 0; i < 10; i++) {
  let bar = document.createElement('div');
  bar.className = 'bar';
  waves.appendChild(bar);
}
  
let avocados = document.querySelectorAll('.avocado');
let bars = document.querySelectorAll('.bar');

function change() {
  for (let i = 0; i < avocados.length; i++)
    avocados[i].className = options[~~(Math.random() * options.length)];
}

function updateBars() {
  for (let i = 0; i < bars.length; i++)
    bars[i].style.height = ~~(Math.random() * 100) + '%';
}

setInterval(change, 3000);
setInterval(updateBars, 100 + ~~(Math.random() * 100));
              
            
!
999px

Console