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

              
                <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <title>Bat with Animated Eyes</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie-edge" />
</head>

<body>
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <!-- Created with Inkscape (http://www.inkscape.org/) -->

  <svg width="90.459236mm" height="104.87884mm" viewBox="0 0 90.459236 104.87884" version="1.1" id="svg5" xml:space="preserve" inkscape:export-filename="animated-bat-eyes.svg" inkscape:export-xdpi="96" inkscape:export-ydpi="96" inkscape:version="1.2.1 (9c6d41e, 2022-07-14)" sodipodi:docname="animated-bat-eyes.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
    <sodipodi:namedview id="namedview7" pagecolor="#ffffff" bordercolor="#000000" borderopacity="0.25" inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="false" inkscape:zoom="1.3768812" inkscape:cx="83.158952" inkscape:cy="185.5643" inkscape:window-width="1440" inkscape:window-height="847" inkscape:window-x="0" inkscape:window-y="25" inkscape:window-maximized="1" inkscape:current-layer="layer2" />
    <defs id="defs2" />
    <g inkscape:groupmode="layer" id="layer2" inkscape:label="Tracing" transform="translate(-59.811092,-122.3044)">
      <ellipse style="fill:#3f3f3f;fill-opacity:0.880223;stroke:#000000;stroke-width:1.43911;stroke-dasharray:none;stroke-opacity:0.564767" id="path290" cx="105.04071" cy="174.74382" rx="44.510063" ry="51.719864" inkscape:label="body" />
      <path style="fill:#3f3f3f;fill-opacity:0.878431;stroke:#000000;stroke-width:1.2161;stroke-dasharray:none;stroke-opacity:0.564767" d="m 71.820191,140.24225 c -1.806546,-4.32322 -6.358635,-6.12768 -3.198519,-14.91853 8.390145,0.3409 12.571393,1.73338 12.959684,6.39202" id="path2892" sodipodi:nodetypes="ccc" inkscape:label="left-ear" />
      <path style="fill:#3f3f3f;fill-opacity:0.878431;stroke:#000000;stroke-width:1.2161;stroke-dasharray:none;stroke-opacity:0.564767" d="m 138.42481,140.05543 c 1.80655,-4.32322 6.35864,-6.12768 3.19852,-14.91853 -8.39014,0.3409 -12.57139,1.73338 -12.95968,6.39202" id="path2892-2" sodipodi:nodetypes="ccc" inkscape:label="right-ear" />
      <ellipse style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.02083;stroke-dasharray:none;stroke-opacity:0.564767" id="path2948" cx="88.444" cy="141.4402" rx="4.4436631" ry="4.5606527" inkscape:label="left-eye" />
      <ellipse style="fill:#56d4f3;fill-opacity:0.928814;stroke:#0e9fc3;stroke-width:0.754235;stroke-dasharray:none;stroke-opacity:0.929412" id="path2948-7" cx="88.271233" cy="141.61299" rx="1.8012569" ry="1.5672781" inkscape:label="left-eyeball" />
      <ellipse style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.02083;stroke-dasharray:none;stroke-opacity:0.564767" id="path2948-2" cx="121.90298" cy="141.32321" rx="4.5606527" ry="4.4436631" inkscape:label="right-eye" />
      <ellipse style="fill:#56d4f3;fill-opacity:0.928814;stroke:#0e9fc3;stroke-width:0.754235;stroke-dasharray:none;stroke-opacity:0.929412" id="path2948-7-1" cx="121.90298" cy="141.32323" rx="1.8012569" ry="1.5672781" inkscape:label="right-eyeball" />
      <path style="fill:#000000;fill-opacity:0.0103627;stroke:#000000;stroke-width:1.549;stroke-dasharray:none;stroke-opacity:0.564767" d="m 98.973049,147.64065 c 0,0 1.311841,3.42683 2.807741,3.50968 1.65195,0.0915 3.50968,-3.50968 3.50968,-3.50968 0,0 1.37368,3.38348 2.80775,3.2757 1.46743,-0.11028 2.33979,-3.74366 2.33979,-3.74366" id="path2976" sodipodi:nodetypes="cacac" inkscape:label="mouth" />
      <path style="fill:#ffccaa;fill-opacity:0;stroke:#000000;stroke-width:1.549;stroke-dasharray:none;stroke-opacity:0.564706" d="m 60.722191,174.08478 c 1.077176,5.78905 2.625844,11.27117 9.846047,13.06082 9.74823,-4.37983 6.276602,-10.61495 7.96524,-16.12587" id="path9650" sodipodi:nodetypes="ccc" inkscape:label="left-hand" />
      <path style="fill:#ffccaa;fill-opacity:0;stroke:#000000;stroke-width:1.549;stroke-dasharray:none;stroke-opacity:0.564706" d="m 149.16682,171.76817 c -1.07718,5.78905 -2.62585,11.27117 -9.84605,13.06082 -9.74823,-4.37983 -6.2766,-10.61495 -7.96524,-16.12587" id="path9650-9" sodipodi:nodetypes="ccc" inkscape:label="right-hand" />
    </g>
  </svg>
</body>

</html>
              
            
!

CSS

              
                * {
  padding: 0;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: plum;
      cursor: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 512 512'%3e%3cg transform='rotate(45 256 256)'%3e%3crect id='r' x='16' y='216' width='480' height='80' rx='14'/%3e%3cuse href='%23r' transform='rotate(90 256 256)'/%3e%3c/g%3e%3c/svg%3e") 16 16, pointer;
}

svg {
  display: block;
  pointer-events: none;
  transform-style: preserve-3d;
}


              
            
!

JS

              
                const t = document.querySelectorAll("ellipse");
const rightEyeBall = Array.from(t).filter(
  (t) => t.getAttribute("inkscape:label") === "right-eyeball"
)[0];
const leftEyeBall = Array.from(t).filter(
  (t) => t.getAttribute("inkscape:label") === "left-eyeball"
)[0];

window.addEventListener("mousemove", (event) => {
  const x = -(window.innerWidth / 2 - event.pageX) / 330;
  const y = -(window.innerHeight / 2 - event.pageY) / 330;
  rightEyeBall.style.transform = `translateY(${y}px) translateX(${x}px)`;
  leftEyeBall.style.transform = `translateY(${y}px) translateX(${x}px)`;
});

              
            
!
999px

Console