HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<svg viewBox="190 190 700 700" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="scene">
<rect width="1080" height="1080" fill="#E6E6E6" />
<ellipse id="shadow" cx="526.126" cy="765.556" rx="175.972" ry="33.5184" fill="#DDDDDD" />
<g id="legLeft">
<rect id="Rectangle 6" width="28.4382" height="69.5478" rx="14.2191" transform="matrix(-1 0 0 1 483.913 715.256)" fill="#6B6B6B" />
<rect width="28.4382" height="69.5478" rx="14.2191" transform="matrix(-0.735032 -0.678032 -0.678032 0.735032 487.568 725.065)" fill="#6B6B6B" />
</g>
<g id="legRight">
<rect x="567.914" y="714.395" width="28.4382" height="69.5478" rx="14.2191" fill="#6B6B6B" />
<rect x="564.259" y="724.203" width="28.4382" height="69.5478" rx="14.2191" transform="rotate(-42.6901 564.259 724.203)" fill="#6B6B6B" />
</g>
<g id="middle">
<g id="body">
<ellipse cx="528.781" cy="653.821" rx="126.827" ry="112.632" fill="#2AD867" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M528.781 766.454C598.826 766.454 655.608 716.026 655.608 653.821C655.608 651.881 655.553 649.952 655.444 648.035L655.156 646.867C574.777 745.976 524.171 757.356 424.893 717.088L428.616 722.919C451.822 749.411 488.06 766.454 528.781 766.454Z" fill="#28CF65" />
</g>
<path id="armRight" d="M654.385 717.896C703.901 688.949 652.099 523.642 600.298 546.495C531.738 602.867 589.633 740.75 654.385 717.896Z" fill="#1F984B" />
<path id="armLeft" d="M386.005 717.896C336.489 688.949 388.29 523.642 440.092 546.495C508.652 602.867 450.757 740.75 386.005 717.896Z" fill="#1F984B" />
</g>
<g id="face">
<g id="hair">
<path d="M430.278 241.052C414.769 255.053 445.117 296.776 470.127 320.319C470.127 320.319 554.349 356.507 538.84 307.395C523.331 258.284 445.787 227.051 430.278 241.052Z" fill="#1F984B" />
<path d="M369.966 308.472C361.565 329.366 436.524 359.738 443.202 363.83C449.879 367.923 482.405 331.951 482.405 331.951C449.233 298.133 378.367 287.579 369.966 308.472Z" fill="#1F984B" />
<path d="M530.654 337.982C508.899 291.025 611.214 246.006 627.154 263.884C643.094 281.763 552.41 384.939 530.654 337.982Z" fill="#1F984B" />
<path d="M558.011 352.629C558.011 352.629 639.863 283.701 666.142 319.027C688.827 349.522 585.345 375.362 572.001 384.353L573.304 387.309C570.035 386.779 569.887 385.777 572.001 384.353L558.011 352.629Z" fill="#1F984B" />
</g>
<path d="M422.786 365.544L416.671 357.833C479.949 290.567 578.589 303.861 624.585 363.683L618.204 370.329L523.818 399.576L422.786 365.544Z" fill="#656565" />
<g id="faceBase">
<path d="M650.5 461C663.477 569.845 586.864 587.5 517 587.5C429.158 584.284 378.804 560.746 386.495 461C393.715 367.359 447.136 334.5 517 334.5C586.864 334.5 637.523 352.155 650.5 461Z" fill="#2AD867" />
</g>
<g id="eyeLeft">
<path d="M422.325 439.558C429.012 415.597 491.899 415.601 498.463 436.276C505.026 456.952 492.556 485.175 462.691 485.175C432.827 485.175 415.639 463.519 422.325 439.558Z" fill="#FEFFFC" />
<g id="Mask Group">
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="420" y="421" width="81" height="65">
<path d="M422.325 439.558C429.012 415.597 491.899 415.601 498.463 436.276C505.026 456.952 492.556 485.175 462.691 485.175C432.827 485.175 415.639 463.519 422.325 439.558Z" fill="#FEFFFC" />
</mask>
<g mask="url(#mask0)">
<circle id="eyeballLeft" cx="464.601" cy="453.822" r="28.0472" fill="#5A5A5A" />
</g>
</g>
</g>
<g id="eyeRight">
<path d="M617.532 439.558C610.845 415.597 547.958 415.601 541.395 436.276C534.831 456.952 547.302 485.175 577.166 485.175C607.03 485.175 624.219 463.519 617.532 439.558Z" fill="#F9FFFB" />
<g id="Mask Group_2">
<mask id="mask1" mask-type="alpha" maskUnits="userSpaceOnUse" x="539" y="421" width="80" height="65">
<path d="M617.532 439.558C610.845 415.597 547.958 415.601 541.395 436.276C534.831 456.952 547.302 485.175 577.166 485.175C607.03 485.175 624.219 463.519 617.532 439.558Z" fill="#F9FFFB" />
</mask>
<g mask="url(#mask1)">
<circle id="eyeballRight" cx="575.525" cy="453.822" r="28.0472" fill="#5A5A5A" />
</g>
</g>
</g>
<g id="eyeLids">
<rect id="eyelidTop" x="411" y="392" width="211" height="24" fill="#2AD867" />
<rect id="eyelidBottom" x="411" y="486" width="211" height="53" fill="#2AD867" />
</g>
<path id="faceShadow" fill-rule="evenodd" clip-rule="evenodd" d="M553.108 341.541C591.695 365.828 611.043 378.006 628.033 448.747C646.083 523.9 582.089 577.065 484.62 583.3C481.531 583.497 478.672 583.697 476.03 583.898C488.565 585.848 502.255 586.96 517 587.5C586.864 587.5 663.477 569.845 650.5 461C639.249 366.628 599.67 340.807 543.806 335.609C544.373 336.003 544.991 336.413 545.661 336.839C548.221 338.464 550.702 340.026 553.108 341.541Z" fill="#28CB62" />
<g id="nose">
<path d="M519.079 487.472C465.586 487.472 476.744 568.204 519.079 568.204C561.414 568.204 572.572 487.472 519.079 487.472Z" fill="#6C997A" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M554.095 534.621L553.537 534.073C526.712 543.846 510.277 542.334 483.505 531.336C486.111 550.288 499.136 568.204 519.079 568.204C537.865 568.204 550.512 552.307 554.095 534.621Z" fill="#588669" />
</g>
<path id="headphoneHandle" fill-rule="evenodd" clip-rule="evenodd" d="M677.713 431C666.076 350.35 599.002 288.5 518 288.5C436.998 288.5 369.924 350.35 358.287 431H380.67C392.309 364.776 449.366 314.5 518 314.5C586.634 314.5 643.691 364.776 655.33 431H677.713Z" fill="#555555" />
<g id="headphoneRight">
<path d="M676.5 404.5H687C706.882 404.5 723 420.618 723 440.5V505.5C723 525.382 706.882 541.5 687 541.5H676.5V404.5Z" fill="#4A4A4A" />
<rect x="640.5" y="394" width="38.5" height="163" rx="15" fill="#585858" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M676.5 490.991V404.5H687C706.882 404.5 723 420.618 723 440.5V464.221C713.435 480.007 696.222 490.643 676.5 490.991Z" fill="#555555" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M640.5 478.575V409C640.5 400.716 647.216 394 655.5 394H664C672.284 394 679 400.716 679 409V490.891C677.843 490.963 676.676 491 675.5 491C662.231 491 650.049 486.343 640.5 478.575Z" fill="#656565" />
</g>
<g id="headphoneRight_2">
<path id="Rectangle 3_2" d="M362.5 405.5H352C332.118 405.5 316 421.618 316 441.5V506.5C316 526.382 332.118 542.5 352 542.5H362.5V405.5Z" fill="#4A4A4A" />
<rect width="38.5" height="163" rx="15" transform="matrix(-1 0 0 1 398.5 395)" fill="#585858" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M362.5 491.991V405.5H352C332.118 405.5 316 421.618 316 441.5V465.221C325.565 481.007 342.778 491.643 362.5 491.991Z" fill="#555555" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M398.5 479.575V410C398.5 401.716 391.784 395 383.5 395H375C366.716 395 360 401.716 360 410V491.891C361.157 491.963 362.324 492 363.5 492C376.769 492 388.951 487.343 398.5 479.575Z" fill="#656565" />
</g>
</g>
<path id="armRightExtended" class="hidden" d="M719.61 626.818C740.497 605.955 737.273 582.441 719.657 571.57C702.041 560.7 624.549 565.516 601.498 533.694C578.447 501.871 538.603 502.828 570.251 572.071C601.899 641.315 659.507 675.603 719.61 626.818Z" fill="#B5ABAB" fill-opacity="0.52" />
<path id="armLeftExtended" class="hidden" d="M321.673 626.818C300.785 605.955 304.01 582.441 321.626 571.57C339.242 560.7 416.734 565.516 439.785 533.694C462.836 501.871 502.68 502.828 471.032 572.071C439.384 641.315 381.776 675.603 321.673 626.818Z" fill="#B5ABAB" fill-opacity="0.52" />
</g>
</svg>
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
background-color: #e6e6e6;
}
svg {
width: 100vw;
height: 100vh;
}
.hidden {
visibility: hidden;
}
const face = "#face";
const middle = "#middle";
const legRight = "#legRight";
const legLeft = "#legLeft";
const shadow = "#shadow";
const eyelidTop = "#eyelidTop";
const eyelidBottom = "#eyelidBottom";
const armRight = "#armRight";
const armLeft = "#armLeft";
const hair = "#hair";
const eyeballLeft = "#eyeballLeft";
const eyeballRight = "#eyeballRight";
const armRightExtended = "#armRightExtended";
const armLeftExtended = "#armLeftExtended";
gsap.set(middle, { transformOrigin: "50% 50%" });
gsap.set(face, { transformOrigin: "50% 90%" });
gsap.set(hair, { transformOrigin: "50% 100%" });
const tl = gsap.timeline({ ease: "power2.inOut", repeat: -1 });
tl.timeScale(4);
tl.to(middle, { y: 8, duration: 1 }, 0);
tl.to(face, { y: 16, duration: 1 }, 0);
tl.to(middle, { y: 0, duration: 1 }, 1);
tl.to(face, { y: 0, rotation: -5, duration: 1 }, 1);
tl.to(middle, { y: 8, duration: 1 }, 2);
tl.to(face, { y: 16, rotation: 0, duration: 1 }, 2);
tl.to(eyelidTop, { y: 25, duration: 0.5 }, 2.5);
tl.to(eyelidBottom, { y: -47, duration: 0.5 }, 2.5);
tl.to(eyeballLeft, { x: 12, duration: 0.3 }, 2.5);
tl.to(eyeballRight, { x: 12, duration: 0.3 }, 2.5);
tl.to(eyelidTop, { y: 0, duration: 0.5 }, 3);
tl.to(eyelidBottom, { y: 0, duration: 0.5 }, 3);
tl.to(middle, { y: 0, duration: 1 }, 3);
tl.to(face, { y: 0, rotation: 10, duration: 1 }, 3);
tl.to(hair, { rotation: 8, duration: 1 }, 3.3);
tl.to(face, { y: 0, duration: 1 }, 3);
tl.to(legRight, { y: -12, duration: 1 }, 3);
tl.to(armRight, { duration: 1, morphSVG: armRightExtended }, 3);
tl.to(middle, { x: 30, duration: 1 }, 4);
tl.to(shadow, { x: 30, duration: 1 }, 4);
tl.to(face, { x: 30, rotation: 0, duration: 1 }, 4);
tl.to(hair, { rotation: 0, duration: 1 }, 4.3);
tl.to(legRight, { x: 30, y: 0, duration: 1 }, 4);
tl.to(armRight, { duration: 1, morphSVG: armRight }, 4);
tl.to(legLeft, { x: 30, y: -12, duration: 1 }, 5);
tl.to(middle, { y: 8, duration: 1 }, 5);
tl.to(face, { y: 16, rotation: -5, duration: 1 }, 5);
tl.to(eyeballLeft, { x: 0, duration: 1 }, 5);
tl.to(eyeballRight, { x: 0, duration: 1 }, 5);
tl.to(legLeft, { y: 0, duration: 1 }, 6);
tl.to(middle, { y: 0, duration: 1 }, 6);
tl.to(face, { y: 0, rotation: 0, duration: 1 }, 6);
tl.to(middle, { y: 8, duration: 1 }, 7);
tl.to(face, { y: 16, duration: 1 }, 7);
tl.to(middle, { y: 0, duration: 1 }, 8);
tl.to(face, { y: 0, rotation: 5, duration: 1 }, 8);
tl.to(middle, { y: 8, duration: 1 }, 9);
tl.to(face, { y: 16, rotation: 0, duration: 1 }, 9);
tl.to(eyelidTop, { y: 25, duration: 0.5 }, 9.5);
tl.to(eyelidBottom, { y: -47, duration: 0.5 }, 9.5);
tl.to(eyeballLeft, { x: -12, duration: 0.3 }, 9.5);
tl.to(eyeballRight, { x: -12, duration: 0.3 }, 9.5);
tl.to(eyelidTop, { y: 0, duration: 0.5 }, 10);
tl.to(eyelidBottom, { y: 0, duration: 0.5 }, 10);
tl.to(middle, { y: 0, duration: 1 }, 10);
tl.to(face, { y: 0, rotation: -10, duration: 1 }, 10);
tl.to(hair, { rotation: -8, duration: 1 }, 10.3);
tl.to(face, { y: 0, duration: 1 }, 10);
tl.to(legLeft, { y: -12, duration: 1 }, 10);
tl.to(armLeft, { duration: 1, morphSVG: armLeftExtended }, 10);
tl.to(middle, { x: 0, duration: 1 }, 11);
tl.to(shadow, { x: 0, duration: 1 }, 11);
tl.to(face, { x: 0, rotation: 0, duration: 1 }, 11);
tl.to(hair, { rotation: 0, duration: 1 }, 11.3);
tl.to(legLeft, { x: 0, y: 0, duration: 1 }, 11);
tl.to(armLeft, { duration: 1, morphSVG: armLeft }, 11);
tl.to(legRight, { x: 0, y: -12, duration: 1 }, 12);
tl.to(middle, { y: 8, duration: 1 }, 12);
tl.to(face, { y: 16, rotation: -5, duration: 1 }, 12);
tl.to(eyeballLeft, { x: 0, duration: 1 }, 12);
tl.to(eyeballRight, { x: 0, duration: 1 }, 12);
tl.to(legRight, { y: 0, duration: 1 }, 13);
tl.to(middle, { y: 0, duration: 1 }, 13);
tl.to(face, { y: 0, rotation: 0, duration: 1 }, 13);
Also see: Tab Triggers