Pen Settings

HTML

CSS

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

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 class="mole-in-hole" viewBox="0 0 200 227" fill="none" xmlns="http://www.w3.org/2000/svg">
  <clipPath id="a" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="177" width="200" height="50">
    <ellipse cx="100" cy="202" rx="100" ry="25" fill="#C4C4C4"/>
  </clipPath>
  <clipPath id="b" x="0" y="0" width="200" height="227">
    <path fill-rule="evenodd" clip-rule="evenodd" d="M200 0H0v202c0 13.807 44.772 25 100 25s100-12.193 110-25V0z" fill="#C4C4C4"/>
  </clipPath>
  <mask id="c" mask-type="alpha" maskUnits="userSpaceOnUse" x="15" y="20" width="171" height="250">
    <path d="M100.5 20c-46.944 0-85 38.056-85 85v165h170V105c0-46.944-38.056-85-85-85z" fill="#C4C4C4"/>
  </mask>
  <mask id="d" mask-type="alpha" maskUnits="userSpaceOnUse" x="60" y="95" width="81" height="50">
    <ellipse cx="100.5" cy="120" rx="40" ry="25" fill="#F3ECEC"/>
  </mask>
  <mask id="e" mask-type="alpha" maskUnits="userSpaceOnUse" x="22" y="13" width="157" height="57">
    <path d="M99.5 13C71 13 29 30.5 22 69.5h157c-5.5-43-51-56.5-79.5-56.5z" fill="#423F3F"/>
  </mask>
  <g class="hole" transform="translate(0 -1)" clip-path="url(#a)">
    <ellipse class="hole__lip" cx="100" cy="202" rx="100" ry="25" fill="#C4C4C4"/>
    <ellipse class="hole__hole" cx="100" cy="214" rx="100" ry="25" fill="#000"/>
  </g>
  <g clip-path="url(#b)">
    <g class="mole">
      <path class="mole__body" d="M100.5 20c-46.944 0-85 38.056-85 85v165h170V105c0-46.944-38.056-85-85-85z" fill="#C4C4C4"/>
      <g mask="url(#c)">
        <rect class="mole__tummy" x="45.5" y="164" width="110" height="123" rx="55" fill="#F3ECEC"/>
      </g>
      <g class="mole__face">
        <g mask="url(#d)">
          <ellipse class="mole__chin" cx="100.5" cy="120" rx="40" ry="25" fill="#E2E0E0"/>
          <ellipse class="mole__muzzle" cx="100.5" cy="116" rx="40" ry="25" fill="#F3ECEC"/>
        </g>
        <ellipse class="mole__nose" cx="100.5" cy="104" rx="10" ry="6" fill="#FFC6C6"/>
        <path class="mole__whiskers" stroke="#9E9E9E" stroke-width="2" stroke-linecap="round" d="m35.631 109.151 33.02 4.718m64.98 10.282 33.02 4.718m-98-7.738-33.02 4.718m131.02-14.718-33.02 4.718"/>
      </g>
      <g class="mole__eyes">
        <circle class="mole__eye" cx="53.5" cy="88" r="7" fill="#323232"/>
        <circle class="mole__eye" cx="147.5" cy="88" r="7" fill="#323232"/>
      </g>
      <g class="mole__cap cap">
        <ellipse class="cap__button" cx="100.5" cy="13.5" rx="6" ry="2.5" fill="#EF2E2E"/>
        <path class="cap__peak" d="M57 66.273C57 68.683 42.578 69 30.882 69 19.187 69 9 68.454 9 67.364 9 64.954 26.246 63 37.941 63 49.637 63 57 63.863 57 66.273z" fill="#EF2E2E"/>
        <path class="cap__strap" fill="#EF2E2E" d="M32 61h136v8H32z"/>
        <g mask="url(#e)">
          <path class="cap__body" d="M-10 13h220v57h-89.5V56.5H82V70h-92V13z" fill="#373737"/>
        </g>
      </g>
    </g>
  </g>
</svg>

              
            
!

CSS

              
                *
*:after
*:before
  box-sizing border-box

body
  min-height 100vh
  display grid
  place-items center
  background linear-gradient(hsl(180, 40%, 90%) 0 52%, hsl(92, 40%, 70%) 50%)

.mole-in-hole
  height 25vmin

.mole
  display none

  &__eye
    fill hsl(0, 0%, 10%)

  &__whiskers
    stroke hsl(0, 10%, 10%)
  &__body
    fill hsl(0, 0%, 75%)
  &__tummy
  &__muzzle
    fill hsl(200, 10%, 96%)
  &__chin
    fill hsl(200, 10%, 70%)
  &__nose
    fill hsl(10, 80%, 86%)

.cap
  &__body
    fill hsl(0, 10%, 10%)

  &__strap
  &__top
  &__peak
    fill hsl(10, 70%, 50%)

.hole
  &__lip
    fill hsl(35, 30%, 30%)
              
            
!

JS

              
                import gsap from 'https://cdn.skypack.dev/gsap'

gsap.set('.mole', {
  yPercent: 80,
})

gsap.set('.mole', {
  display: 'block',
})

gsap
  .timeline({
    repeat: -1,
    repeatDelay: 1,
  })
  // Shooting up!
  .to('.mole', {
    yPercent: 5,
    ease: 'back.out(1)',
  })
  .to(
    '.cap',
    {
      yPercent: -15,
      duration: 0.1,
      repeat: 1,
      yoyo: true,
    },
    '>-0.2'
  )
  // Blink
  .to('.mole__eyes', {
    delay: 0.2,
    repeat: 3,
    yoyo: true,
    duration: 0.05,
    scaleY: 0.1,
    transformOrigin: '50% 50%',
  })
  // Side to side
  .to(['.cap__body', '.mole__face'], {
    xPercent: 10,
  })
  .to(
    '.cap__peak',
    {
      xPercent: -10,
    },
    '<'
  )
  .to(
    ['.mole__eyes', '.mole__tummy'],
    {
      xPercent: 8,
    },
    '<'
  )
  .to(
    '.mole__nose',
    {
      xPercent: 25,
    },
    '<'
  )
  .to(['.mole__face', '.cap__body'], {
    xPercent: -10,
    duration: 0.75,
  })
  .to(
    '.cap__peak',
    {
      xPercent: 28,
      duration: 0.5,
    },
    '<'
  )
  .to(
    ['.mole__eyes', '.mole__tummy'],
    {
      xPercent: -8,
      duration: 0.75,
    },
    '<'
  )
  .to(
    '.mole__nose',
    {
      xPercent: -25,
      duration: 0.75,
    },
    '<'
  )
  .to('.mole__eyes', {
    delay: 0.2,
    repeat: 3,
    yoyo: true,
    duration: 0.05,
    scaleY: 0.1,
    transformOrigin: '50% 50%',
  })
  .to('.mole', {
    yPercent: 80,
    delay: 0.2,
    ease: 'power4.in',
  })
  .to(
    '.cap',
    {
      yPercent: -15,
      duration: 0.2,
      ease: 'power4.in',
    },
    '<+0.05'
  )

              
            
!
999px

Console