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 id="devavocado">
  <svg xmlns="http://www.w3.org/2000/svg"  viewBox="0 0 531.05 595.94">
    <g>
      <path d="M343.37 665.15c-10.11.5-19.18-3.24-28.43-6.51-9.93-3.52-19.88-7.14-30.09-9.62-9.33-2.27-18.81-4-27.47-8.25-6.26-3.09-12.06-7.1-18.25-10.36-8.57-4.52-17.12-9.16-26-12.93a78.69 78.69 0 0 1-24.91-16.18c-4.24-4.16-8.28-8.57-12.83-12.36-6-5-12.43-9.29-18.48-14.14-6.34-5.09-13.34-9.63-17.55-16.84a88 88 0 0 1-7.05-14.76 80 80 0 0 0-13-23.21 60 60 0 0 1-11.63-24.47c-1.74-7.53-3.8-15-5.67-22.5-.47-1.86-.8-3.75-1.1-5.64-1.18-7.34-4.44-13.87-8-20.26s-4-13.54-2.74-20.47c1.27-7.12 3.9-14 5.51-21.06A75.19 75.19 0 0 0 98 390c.1-8.79 1.42-17.33 5.12-25.18 2-4.22 2.58-8.55 3.74-12.86a23 23 0 0 1 3.4-6.94 39.31 39.31 0 0 0 7.38-20.52c.32-5.44 3.25-9.91 7.07-13.49 6-5.61 10.47-12.12 12-20.15s6.11-13.74 12.68-18.06c7.29-4.79 14.94-9.05 22-14.19a56.51 56.51 0 0 0 11-11.17c6.49-8.47 14.08-15.48 24.11-19.27 7.87-3 15.76-6 24.38-6.41 6.58-.32 11.59-4 16.13-8.56a27.72 27.72 0 0 1 14.2-7.71 26.94 26.94 0 0 0 13.9-8.27A60.22 60.22 0 0 1 294 183.8a43.43 43.43 0 0 0 16.09-12.74c6.18-7.81 12.75-15.35 19.5-22.68 7.13-7.76 14.11-15.81 22.19-22.49a190.83 190.83 0 0 0 19-18.76c5.26-5.75 12.47-8.76 19.35-12.23a62.75 62.75 0 0 0 11.66-7.73c7.51-6.24 15.73-10.89 25.29-13.12 2.05-.47 4-1.44 6-2 4.64-1.22 9.22-2.35 14.16-1a12.71 12.71 0 0 0 7-.54c6-2.05 11.93-1.39 17.84.25 6.74 1.87 13.39 3.91 20.57 3.74a35.74 35.74 0 0 1 19.15 5.37c9 5.3 18.41 9.92 27.28 15.41 4.76 3 8.93 6.94 13.05 10.8 6.7 6.28 13.83 11.94 22.17 15.83a22.06 22.06 0 0 1 10.85 11 57.24 57.24 0 0 0 9.14 13.09 93.93 93.93 0 0 1 10.53 15c4.61 7.94 10.35 15.33 12.82 24.39 1 3.51 2 7 2.62 10.61.77 4.44.4 8.78-2.13 12.77a12.63 12.63 0 0 0-1.25 12.12c2.15 5.22 1 10.32-.23 15.53a39.63 39.63 0 0 0-1.12 9.88 18.52 18.52 0 0 1-2 9.69c-2.74 5-3.87 10.36-4.55 16a26.49 26.49 0 0 1-2.79 8.93c-5.23 10.06-10.27 20.2-12.78 31.31a61.66 61.66 0 0 0-1.16 13.72 19.82 19.82 0 0 1-5.5 14.36 15.82 15.82 0 0 0-3.72 7 33.41 33.41 0 0 1-7.31 14.12c-4.19 5-4.25 11.15-4 17.21.31 7.28.85 14.57 1.46 21.84.74 8.76-1.26 17.08-3.27 25.53-2.71 11.45-3 23.2-2.1 34.92.17 2.16 1.14 4.25 1.71 6.38a26.79 26.79 0 0 1-.67 16.64 32.5 32.5 0 0 0-2.27 12.31c.52 9.35-2.88 17.47-6.31 25.74-1.85 4.49-2.93 9.32-5 13.71-2.74 5.91-6.2 11.47-9.1 17.31-2.05 4.12-3.45 8.56-5.55 12.65a143.73 143.73 0 0 1-17.14 25.81c-4.08 5-7.74 10.24-11.5 15.43-2.69 3.71-5.73 6.93-10 8.82-6.16 2.7-11.4 6.41-15.33 12.16-1.65 2.41-4.78 4.22-7.62 5.32-7.76 3-15.38 6-20.91 12.66a12.26 12.26 0 0 1-2.37 1.59c-4.28 3-9.25 4.32-14.3 4.86-7.69.82-15 2.88-22.33 5.2-10.47 3.29-21.4 4.21-32.4 4.53-9.2.27-18.38 1.27-27.57 2z" transform="translate(-89.57 -69.26)" fill="#524237"/>
      <path d="M523 109s91 42 52 137-50 132-52 207-73 148-140 163-183 23-249-97 36-240 36-240 52-42 87-54 74-63 74-63 84-119 192-53z" transform="translate(-89.57 -69.26)" fill="#c5f288"/>
      <path d="M506.47 130.85C490 120 420.79 76.64 344.7 186.14c0 0-56.65 55.07-120.13 88.87s-86.67 101.56-89.68 130.77 7.45 141.84 85.74 126.39l24.24 9.55 1-1.63 12.68 11c20.78 75.26 131.06 37 157.08 22s79.09-63.89 82.2-133.88 29.21-143 29.21-143C594 185.68 524 141 506.47 130.85z" transform="translate(-89.57 -69.26)" fill="#e7f7a2"/>
      <ellipse cx="300.15" cy="425.68" rx="130.16" ry="119.59" transform="rotate(-60 195.375 468.62)" fill="#c8d388"/>
      <ellipse id="pit" cx="302.15" cy="425.68" rx="122.88" ry="112.9" transform="rotate(-60 197.382 468.625)" fill="#a07b3a"/>
      <g id="arms" fill="#e6f6a2">
        <path id="arm-l" d="M192.66 311s6.7 24.8 17 36.75c0 0 14 3.87 14.32 7.52s-6.44 2.07-6.44 2.07 11.19 12 5.07 19.06c-9 10.4-23.65-.77-23.65-.77s-36.67-34.21-34.82-42.12 20.47-33.97 28.52-22.51z" transform="translate(-90 -70)"/>
        <path id="arm-r" d="M447 437s-30 9-49 6c0 0-13-12-17-10s2 8 2 8-19.6-3.88-23 7c-5 16 16 24 16 24s59 16 66 9 22-43 5-44z" transform="translate(-90 -70)"/>
      </g>
    </g>
    <g id="faces">
      <g id="lg-face">
        <circle cx="389.07" cy="140.44" r="8" fill="#171603"/>
        <circle cx="321.99" cy="135.94" r="8" fill="#171603"/>
        <path d="M427.87,237.82s-4.36-6,2.73-8.17,17.92-.27,21.26,1.64c3.82,2.19,5.45,5.46,1.64,8.73C445.86,246.56,433.86,247.1,427.87,237.82Z" transform="translate(-89.57 -69.26)" fill="#171603"/>
      </g>
      <g id="sm-face">
        <circle cx="205.93" cy="343.24" r="6" fill="#171603"/>
        <circle cx="178.93" cy="342.24" r="6" fill="#171603"/>
        <path d="M 272 427 s 10 13 19 0" transform="translate(-89.57 -69.26)" fill="none" stroke="#171603" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
      </g>
    </g>
  </svg>
</div>
              
            
!

CSS

              
                body, html {
  background: #E885A6;
}

svg {
  margin: 15vmin;
  width: 70vw;
  height: 70vh;
}

#pit {
  cursor: pointer;
}
              
            
!

JS

              
                TweenMax.set('#faces', {
  transformOrigin: '50% 50%',
  rotation: 30
})

TweenMax.set('#lg-face', {
  x: -60
})

TweenMax.set('#sm-face', {
  x: 80,
  y: 20
})

const tl = new TimelineMax()

tl.add('start')
tl.to('svg', 3, {
  rotation: 5,
  repeat: -1,
  yoyo: true,
  ease: Bounce.easeOut
}, 'start')
tl.to('#lg-face circle', 0.05, {
  scaleY: 0.1,
  transformOrigin: '50% 70%',
  repeat: -1,
  repeatDelay: 0.5,
  yoyo: true,
  ease: Sine.easeOut
}, 'start')
tl.to('#sm-face circle', 0.1, {
  scaleY: 0.1,
  transformOrigin: '50% 70%',
  repeat: -1,
  repeatDelay: 0.5,
  yoyo: true,
  ease: CustomEase.create("custom", "M0,0 C0.14,0 0.242,0.438 0.272,0.561 0.313,0.728 0.354,0.963 0.362,1 0.37,0.985 0.414,0.752 0.42,0.678 0.432,0.522 0.537,0.047 0.55,0.056 0.626,0.106 0.719,0.981 0.726,0.998 0.788,0.914 0.84,0.936 0.859,0.95 0.878,0.964 0.897,0.985 0.911,0.998 0.922,0.994 0.939,0.984 0.954,0.984 0.969,0.984 1,1 1,1")
}, 'start+=0.5')
tl.to('#lg-face path', 0.3, {
  scaleY: 0.7,
  transformOrigin: '50% 70%',
  repeat: -1,
  repeatDelay: 0.5,
  yoyo: true,
  ease: Back.easeInOut
}, 'start+=1')
tl.to('#sm-face path', 1, {
  attr: {
    d: `M 272 427 s 10 4 19 0`
  },
  repeat: -1,
  repeatDelay: 0.5,
  yoyo: true,
  ease: Elastic.easeOut
}, 'start+=1')
tl.to('#arm-l', 1, {
  bezier: {
    type: "soft",
    values:[
      {x:-85, y:-75}, 
      {x:-60, y:-70}, 
      {x:-85, y:-60}, 
      {x:-90, y:-70}
    ]
  },
  repeat: -1,
  ease: Linear.easeNone
}, 'start')
tl.to('#arm-r', 1, {
  bezier: {
    type: "soft",
    values:[
      {x:-95, y:-75}, 
      {x:-100, y:-70}, 
      {x:-95, y:-60}, 
      {x:-90, y:-70}
    ]
  },
  repeat: -1,
  ease: Linear.easeNone
}, 'start')


const pit = document.getElementById('pit')

pit.addEventListener('mouseenter', () => {
  TweenMax.to('#devavocado', 1.25, {
    rotation: 5,
    svgOrigin: '250 250',
    ease: Elastic.easeOut.config(1.5, 0.25)
  })
}, false);

pit.addEventListener('mouseleave', () => {
  TweenMax.to('#devavocado', 1, {
    rotation: 0,
    svgOrigin: '250 250',
    ease: Elastic.easeOut.config(1.5, 0.3)
  })
}, false);
              
            
!
999px

Console