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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <div id="oscar">
<svg xmlns="http://www.w3.org/2000/svg" id="oscar" viewBox="0 0 365 340">
  <g id="g3067">
    <path id="face" fill="#008000" d="M74.736 289.746c-21.582-15.046-58.52-123.907-3.96-190.119l85.817-7.921c85.881-30.134 79.187-36.65 126.745-14.523 76.056 31.496 53.67 179.945-2.093 214.707-28.179 17.567 6.794 88.399 49.694 96.728l-287.093-.934c44.76-18.206 58.031-79.017 30.89-97.938z"/>
    <path id="hair" fill="#744614" d="M194.866 109.535c-22.716-13.231-38.287 3.873-58.618 3.32l-76.046 7.468c-19.763.2-38.515 19.481-60.202-16.596l35.646-4.15C17.443 103.076 11.366 84.343.792 73.854 21.3 84.823 36.45 73.35 50.697 58.087c7.286-9.294-2.062-11.237-7.922-16.596 17.692 4.87 35.383 5.059 53.074 3.319 13.783-3.745 10.294-12.919 3.168-23.235l41.984 27.384c6.93-6.915 3.357-13.83 0-20.745 16.063 13.176 41.945 7.495 46.736 42.32-5.235-18.775 5.032-34.598 22.972-48.959-.766 13.09-5.122 29.186 3.96 34.022C218.438 19.785 218.951 7.554 260.613 0c-10.917 0-20.897 42.724-19.011 38.171 7.48-18.059 48.992-32.863 58.618-14.936-33.916-3.946-20.781 39.675-23.764 24.064-4.005-20.965 65.416-19.8 68.124-14.936l-26.933 29.043c23.44-3.784 48.385-8.595 24.556 19.916l22.972 3.319c-18.813 44.158-53.321 25.842-81.59 32.363-29.573-2.49-53.923-21.392-88.72-7.469z"/>
    <path id="path3767" fill="#f6f8f7" stroke="#000" stroke-width="2.996" d="M152.174 96.805c-28.528-19.623-76.128-13.5-70.172 37.711 9.307 80.02 154.6 20.362 70.172-37.711z"/>
    <path id="path3767-1" fill="#f6f8f7" stroke="#000" stroke-width="2.996" d="M226.971 94.305c28.433-19.76 76.129-13.498 70.173 37.712-9.307 80.02-156.582 22.342-70.173-37.712z"/>
    <path id="path3787" d="M156.449 228.132a7.922 7.922 0 1 1-.001-.045l-7.918.258z" transform="matrix(1.83333 0 0 1.75 -131.555 -269.608)"/>
    <path id="path3787-7" d="M156.449 228.132a7.922 7.922 0 1 1-.001-.045l-7.918.258z" transform="matrix(1.83333 0 0 1.75 -41.777 -270.929)"/>
    <path id="augenbrauen" fill="#744614" stroke="#000" stroke-width="8" d="M81.245 77.736c-6.515 1.796 5.33 15.029 6.815 15.312 12.5 2.383 36.008.637 52.03 7.24 11.1 12.156 29.535 20.517 47.529 17.163 23.077 3.337 36.992-8.402 49.51-19.144 15.308-25.046 21.233-11.52 34.956-11.203 2.193.051 14.963-.778 17.194-1.34l-5.333-7.408 1.373 5.428"/>
    <path id="path3813" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="5.806" d="M299.125 219.85c-2.06-16.869-4.118-16.763-6.177-25.107l2.47 13.214c-8.711 12.663-23.932 11.81-40.768 10.57l16.678 3.304c-16.472-.348-32.945 2-49.417-6.607l4.942 8.59c-22.965-10.44-47.333-16.378-78.45-.661l6.178-9.25c-18.784 10.552-34.479 7.885-50.035 4.625l14.208-5.286c-31.221 13.82-37.1 3.38-43.858-11.232l1.853-7.928-4.324 24.446"/>
    <path id="path3815" stroke="#000" stroke-width="1.051" d="M104.586 217.701c18.86 8.454 28.906 2.028 46.307 3.117 28.27-21.854 51.905-2.944 72.855-.78 16.877 1.824 34.084 5.735 49.393-2.337-24.26 106.064-144.044 104.738-168.555 0z"/>
    <path id="path3817" fill="#c70000" stroke="#000" stroke-width=".968" d="M155.198 231.08c13.177-6.38 25.678-10.84 33.975-3.303 13.054-7.84 22.9-1.957 32.738 3.964-20.257 60.314-51.313 50.98-66.713-.66z"/>
    <path id="path3827" fill="#fff" d="M152.49 227.292a2.31 2.31 0 1 1 0-.013l-2.31.075z" transform="matrix(1.85714 0 0 1.85714 -138.156 -292.235)"/>
    <path id="path3827-4" fill="#fff" d="M152.49 227.292a2.31 2.31 0 1 1 0-.013l-2.31.075z" transform="matrix(1.85714 0 0 1.85714 -48.378 -293.555)"/>
  </g>
</svg>

</div>
              
            
!

CSS

              
                
body{
  margin:0;
  background:green;
  height:3000px;
}
#oscar{
  position: fixed;
  width: 200px;
}


              
            
!

JS

              
                console.clear();

var $oscar = document.querySelector('#oscar');
var ww = window.innerWidth;
var wh = window.innerHeight;

function moveOscar(e) {

  w = window.innerWidth;
  wh = window.innerHeight;

  if(e.clientX > ww / 2){
    gsap.timeline()
      .to($oscar, {
      x: e.clientX - 150,
      y: e.clientY - 150,
      duration: 0.3, ease:'none',
      overwrite:true
    })
    .to($oscar, {
      rotation:360, transformOrigin:'center',
      duration:1, ease:'none'
    },0)

  } else {
    gsap.timeline()
      .to($oscar, {
      x: e.clientX - 50,
      y: e.clientY - 50,
      duration: 0.3, ease:'none',
      overwrite:true
    })
      .to($oscar, {
      rotation:-360, transformOrigin:'center',
      duration:1, ease:'none'
    },0)
  }
}

window.addEventListener("mousemove", moveOscar);
window.addEventListener("resize", moveOscar);


// playground ==========================
/*
gsap.registerPlugin(CustomEase, CustomWiggle);

CustomWiggle.create("myWiggle", {wiggles:10, type:"anticipate"});

gsap.set($oscar, {perspective:600, force3D:true, transformStyle:"preserve-3d"});

gsap.to('#augenbrauen', {y:3, transformOrigin:"center center", duration:1, repeat:-1, yoyo:true,repeatDelay:1});

gsap.to(oscar,1,{rotationY:30, transformOrigin:"center bottom", duration:1, repeat:-1, yoyo:true, repeatDelay:1.5});

gsap.to(oscar,{rotationX:50, transformOrigin:"50% 100%", duration:5, ease:"myWiggle", repeat:-1, repeatDelay:2, force3D:true});


var ätsch = gsap.timeline({repeat:-1, repeatDelay:3})
.from('#zunge', {scaleY:0.2, transformOrigin:'center top', duration:0.2, repeat:1, yoyo:true, repeatDelay:0.5})

*/
              
            
!
999px

Console