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

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.

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

              
                <svg height='100%' version='1.1' viewbox='0 0 800 400' width='100%' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>
  <defs>
    <clipPath id='clippath-control'>
      <path d='M40,40 C42.7614237,40 45,42.2385763 45,45 L45,115 C45,117.761424 42.7614237,120 40,120 L13,120 L13,40 L40,40 Z'></path>
    </clipPath>
    <g id='eye'>
      <circle class='white' cx='9' cy='9' r='9'></circle>
      <circle class='dark' cx='9' cy='9' r='5'></circle>
      <circle class='white' cx='6' cy='5' r='3'></circle>
    </g>
    <g id='eye-lg'>
      <circle class='white' cx='9' cy='9' r='9'></circle>
      <circle class='dark' cx='9' cy='9' r='6'></circle>
      <circle class='white' cx='4.5' cy='6.5' r='2.5'></circle>
    </g>
    <path class='s sw10 sdark' d='M8,35 L0,35 C6.09654065,25.9153025 8.76320731,16.5819692 8,7' id='foot-sm'></path>
    <polyline id='foot-ext' points='0 0 0 34 8 34'></polyline>
  </defs>
  <g fill-rule='evenodd' fill='none' stroke-width='1' stroke='none'>
    <g id='bread-a' transform='translate(334, 220)'>
      <path class='yellow-darken' d='M15.5,31 C6.93958638,31 0,24.0604136 0,15.5 C0,6.93958638 6.93958638,0 15.5,0 L81.5,0 C90.0604136,0 97,6.93958638 97,15.5 C97,24.0604136 90.0604136,31 81.5,31 L84,31 C91.1797017,31 97,36.8202983 97,44 L97,112 C97,119.179702 91.1797017,125 84,125 L13,125 C5.82029825,125 0,119.179702 0,112 L0,44 C0,36.8202983 5.82029825,31 13,31 L15.5,31 Z'></path>
      <path class='yellow' d='M32.5,31 C23.9395864,31 17,24.0604136 17,15.5 C17,6.93958638 23.9395864,0 32.5,0 L98.5,0 C107.060414,0 114,6.93958638 114,15.5 C114,24.0604136 107.060414,31 98.5,31 L101,31 C108.179702,31 114,36.8202983 114,44 L114,112 C114,119.179702 108.179702,125 101,125 L30,125 C22.8202983,125 17,119.179702 17,112 L17,44 C17,36.8202983 22.8202983,31 30,31 L32.5,31 Z' fill='#FFDE32'></path>
      <use transform='translate(35 48)' xlink:href='#eye'></use>
      <use transform='translate(79 48)' xlink:href='#eye'></use>
      <path class='s sw4 sdark' d='M61,65 C61.6666667,68.3333333 63.6666667,70 67,70 C70.3333333,70 72.3333333,68.3333333 73,65'></path>
      <path class='s sw4 syellow-darken' d='M38,20 L47,12'></path>
      <path class='s sw4 syellow-darken' d='M78,35 L91,22'></path>
      <path class='s sw4 syellow-darken' d='M42,35 L66,12'></path>
      <path class='s sw4 syellow-darken' d='M57,38 L81,15'></path>
      <path class='s sw4 syellow-darken' d='M37,92 L46,84'></path>
      <path class='s sw4 syellow-darken' d='M77,107 L90,94'></path>
      <path class='s sw4 syellow-darken' d='M41,107 L65,84'></path>
      <path class='s sw4 syellow-darken' d='M56,110 L80,87'></path>
    </g>
    <g id='bread-b' transform='translate(334, 220)'>
      <path class='dark' d='M15.5,31 C6.93958638,31 0,24.0604136 0,15.5 C0,6.93958638 6.93958638,0 15.5,0 L81.5,0 C90.0604136,0 97,6.93958638 97,15.5 C97,24.0604136 90.0604136,31 81.5,31 L84,31 C91.1797017,31 97,36.8202983 97,44 L97,112 C97,119.179702 91.1797017,125 84,125 L13,125 C5.82029825,125 0,119.179702 0,112 L0,44 C0,36.8202983 5.82029825,31 13,31 L15.5,31 Z'></path>
      <path d='M32.5,31 C23.9395864,31 17,24.0604136 17,15.5 C17,6.93958638 23.9395864,0 32.5,0 L98.5,0 C107.060414,0 114,6.93958638 114,15.5 C114,24.0604136 107.060414,31 98.5,31 L101,31 C108.179702,31 114,36.8202983 114,44 L114,112 C114,119.179702 108.179702,125 101,125 L30,125 C22.8202983,125 17,119.179702 17,112 L17,44 C17,36.8202983 22.8202983,31 30,31 L32.5,31 Z' fill='#7D7C71'></path>
      <path class='s sw4 sdark' d='M38,20 L47,12'></path>
      <path class='s sw4 sdark' d='M41,64 L51,53'></path>
      <path class='s sw4 sdark' d='M51,64 L40,53'></path>
      <path class='s sw4 sdark' d='M83,64 L93,53'></path>
      <path class='s sw4 sdark' d='M93,64 L82,53'></path>
      <path class='s sw4 sdark' d='M70,69 L64,69'></path>
      <path class='s sw4 sdark' d='M78,35 L91,22'></path>
      <path class='s sw4 sdark' d='M42,35 L66,12'></path>
      <path class='s sw4 sdark' d='M57,38 L81,15'></path>
      <path class='s sw4 sdark' d='M37,92 L46,84'></path>
      <path class='s sw4 sdark' d='M77,107 L90,94'></path>
      <path class='s sw4 sdark' d='M41,107 L65,84'></path>
      <path class='s sw4 sdark' d='M56,110 L80,87'></path>
    </g>
    <rect fill='#FDFDF2' height='40' width='272' x='258' y='305'></rect>
    <g transform='translate(263, 193)'>
      <path class='s sw10' d='M0,157 L263,157' stroke-opacity='0.75' stroke='#B5B28F'></path>
      <use transform='translate(18 122)' xlink:href='#foot-sm'></use>
      <use transform='translate(69 122)' xlink:href='#foot-sm'></use>
      <use transform='translate(189 122)' xlink:href='#foot-sm'></use>
      <use transform='translate(240 122)' xlink:href='#foot-sm'></use>
      <g id='toaster'>
        <path class='s sw10' d='M237,114 L267,114' id='control-right' stroke='#BCB993'></path>
        <path d='M1,140 L259,140 C259,70.6666667 259,32 259,24 C259,12 247,-5.68434189e-14 230,-5.68434189e-14 C213,-5.57137059e-14 45,-5.68434189e-14 32,-5.68434189e-14 C19,-5.58719737e-14 1,10 1,24 L1,140 Z' fill='#EAE6D8'></path>
        <path d='M83,140 L259,140 C259,70.6666667 259,32 259,24 C259,12 247,-1.13686838e-13 230,-1.13686838e-13 C213,-1.12557125e-13 127,-1.13686838e-13 114,-1.13686838e-13 C101,-1.12715393e-13 83,10 83,24 L83,140 Z' fill='#DBD6C1'></path>
        <path class='s sw10 sdark' d='M40,45 L40,115'></path>
        <path clip-path='url(#clippath-control)' d='M20,114 L50,114' id='control-left' stroke-linecap='round' stroke-width='9' stroke='#CECAB2'></path>
        <g id='face'>
          <g class='s sw4 sdark' id='eyes-a' transform='translate(136.000000, 73.000000)'>
            <polyline id='eye-left' points='0 0 14 5 0 11'></polyline>
            <polyline id='eye-right' points='71 0 57 6 71 11'></polyline>
          </g>
          <g class='hide' id='eyes-b' transform='translate(133.000000, 68.000000)'>
            <use transform='translate(1 1)' xlink:href='#eye-lg'></use>
            <use transform='translate(58 1)' xlink:href='#eye-lg'></use>
          </g>
          <path class='s sw4 sdark' d='M128,101 L219,101' id='mouth'></path>
        </g>
      </g>
    </g>
  </g>
</svg>
<div class='credits'>
  <span>
    Original by&nbsp;
    <a href='https://www.behance.net/gallery/43627687/Moody-Foodies-Animated-Stickers' rel='noopener noreferrer' target='_blank'>Jonas Mosesson</a>
  </span>
  <span>
    Recreated by&nbsp;
    <a href='https://twitter.com/pixelia_me' rel='noopener noreferrer' target='_blank' title='Noel Delgado'>
      <svg height='12' viewBox='0 0 57 30'>
        <path d='M28.1312,9.5341 C29.7966,9.5341 32.1025,10.627 34.248,12.368 C49.3297,11.5836 53.8793,-0.4796 55.5773,0.6783 C57.8326,3.2476 50.8638,16.3535 39.4,19.088 C39.8655,20.2628 40.1364,21.4786 40.1364,22.6983 C40.1364,25.9478 38.837,26.7409 36.7281,28.8974 L36.704,28.824 C36.4799,29.0276 36.208,29.2318 35.8945,29.4 C35.8945,29.4 36.1346,27.0065 34.9341,26.7672 C34.9341,26.7672 34.3739,27.4054 33.0133,27.2459 C32.8532,25.8896 32.293,25.4109 32.1329,25.3311 C31.4126,25.4109 30.9324,26.5278 30.132,26.5278 C29.8,26.1969 29.5184,25.5615 29.312,24.972 C29.0201,25.4221 28.6036,26.1128 28.2512,26.2885 C27.8796,26.2885 27.1476,25.2858 26.836,24.832 C26.6262,25.4581 26.3285,26.1707 25.9702,26.5278 C25.1699,26.5278 24.6896,25.4109 23.9694,25.3311 C23.8093,25.4109 23.249,25.8896 23.089,27.2459 C21.7284,27.4054 21.1681,26.7672 21.1681,26.7672 C19.9676,27.0065 20.2077,29.4 20.2077,29.4 C19.6122,29.0804 19.1739,28.6307 18.908,28.304 L18.8667,28.3947 C17.1544,26.3262 16.1259,25.5896 16.1259,22.6983 C16.1259,21.4938 16.3637,20.2895 16.784,19.128 C5.2094,16.4922 -1.8448,3.2615 0.4227,0.6783 C2.119,-0.4785 6.6627,11.5578 21.708,12.364 C23.8143,10.6244 26.1724,9.5341 28.1312,9.5341 Z M28.8514,20.3048 C28.8514,20.3048 30.4121,21.7409 32.213,21.7409 C34.0137,21.7409 35.3343,19.3474 35.3343,19.3474 L28.8514,20.3048 Z M20.6879,19.3474 C20.6879,19.3474 22.2486,21.7409 24.0494,21.7409 C25.8502,21.7409 27.1707,20.3048 27.1707,20.3048 L20.6879,19.3474 Z' fill-rule='evenodd'></path>
      </svg>
    </a>
  </span>
</div>
              
            
!

CSS

              
                :root {
  font-size: 13px;
  font-family: monospace;

  --color-dark: #494641;
  --color-yellow: #FFDE32;
  --color-yellow-darken: #FFBB03;

  --fg-color: var(--color-dark);
  --bg-color: #FDFDF2;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  overflow: hidden;
}

body {
  width: 100vw;
  height: 100vh;
  color: var(--fg-color);
  background-color: var(--bg-color);
}

a {
  color: inherit;
}

svg {
  display: block;
  fill: currentColor;
}

.hide {
  opacity: 0;
}

.s { stroke-linecap: round; stroke-linejoin: round; }
.sw4 { stroke-width: 4 }
.sw10 { stroke-width: 10 }
.sdark { stroke: var(--color-dark); }
.syellow-darken { stroke: var(--color-yellow-darken); }
.dark { fill: var(--color-dark); }
.white { fill: #FFFFFF; }
.yellow { fill: var(--color-yellow); }
.yellow-darken { fill: var(--color-yellow-darken); }

.credits {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  font-size: 0.75rem;
}

.credits > span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 1em;
}
              
            
!

JS

              
                /**
 * Noel Delgado | @pixelia_me
 *
 * Original work by Jonas Mosesson
 * https://www.behance.net/gallery/43627687/Moody-Foodies-Animated-Stickers
 */

const { log } = console;

log('🍞');

internals = {};

// -------

internals.toaster = document.getElementById('toaster');
internals.eyesA = document.getElementById('eyes-a');
internals.breadA = document.getElementById('bread-a');
internals.face = document.getElementById('face');
internals.eyesB = document.getElementById('eyes-b');
internals.breadB = document.getElementById('bread-b');
internals.foot = document.getElementById('foot-sm');
internals.footExt = document.getElementById('foot-ext');
internals.controlClipPath = document.querySelector('#clippath-control > path');
internals.controlLeft = document.getElementById('control-left');
internals.controlRight = document.getElementById('control-right');
internals.ease = CustomEase.create('custom', 'M0,0 C0.061,0 0.261,0.123 0.328,0.23 0.405,0.354 0.447,0.757 0.542,0.868 0.626,0.966 0.939,0.998 1,1');
internals.footExtended = '0 0 0 34 8 34';

// -------

TweenLite.defaultEase = Expo.easeInOut;
TweenMax.set(internals.toaster, { transformOrigin: 'center bottom', scaleX: 1 });
TweenMax.set(internals.breadA, { transformOrigin: 'center' });
TweenMax.set(internals.breadB, { transformOrigin: 'center' });
TweenMax.set(internals.eyesB, { transformOrigin: 'center' });
TweenMax.set(internals.foot, { transformOrigin: 'center bottom'} );

// -------

internals.timeline = new TimelineMax({
  repeat: 1,
  yoyo: true,
  onComplete: () => internals.timeline2.restart()
});

internals.timeline2 = new TimelineMax({
  paused: true,
  repeat: 1,
  yoyo: true,
  onComplete: () => internals.timeline.restart()
});

internals.timeline
.to(internals.toaster, 0.5, { rotation: 3, y: -7, scaleY: 1.15, scaleX: .96, ease: Back.easeInOut.config(1) })
.to(internals.foot, 0.5, { morphSVG: internals.footExt }, 0)
.to(internals.controlLeft, 0.5, { y: -68, ease: internals.ease }, 0)
.to(internals.controlRight, 0.5, { y: -68, ease: internals.ease }, 0)
.to(internals.breadA, 0.5, { y: 46, rotation: -12, ease: internals.ease }, 0)
.to(internals.face, 0.5, { y: -14 }, 0)
.to(internals.eyesA, 0, { autoAlpha: 0 }, 0.2)
.to(internals.eyesB, 0, { autoAlpha: 1, scaleX: 1.15 }, 0.2)

internals.timeline2
.to(internals.toaster, 0.5, { rotation: -3, y: -7, scaleY: 1.1, scaleX: .96, ease: Back.easeInOut.config(1) })
.to(internals.foot, 0.5, { morphSVG: internals.footExt }, 0)
.to(internals.controlLeft, 0.5, { y: -68, ease: internals.ease }, 0)
.to(internals.controlRight, 0.5, { y: -68, ease: internals.ease }, 0)
.to(internals.breadB, 0.5, { y: 60, rotation: 12, ease: internals.ease }, 0)
.to(internals.face, 0.5, { y: -14 }, 0)
.to(internals.eyesA, 0, { autoAlpha: 0 }, 0.2)
.to(internals.eyesB, 0, { autoAlpha: 1, scaleX: 1.15 }, 0.2)
              
            
!
999px

Console