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

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

              
                <!--
  Original illustration by Oleg Milshtein!
  https://dribbble.com/shots/279898-Cubes-The-Dark-Knight

  Watch me code this project:
  https://youtu.be/hhM34QXc6uA
-->

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1600 800">

  <g class="joker">

    <defs>
      <linearGradient id="joker-shoes" x1="0%" y1="0%" x2="0%" y2="100%">
        <stop offset="70%" style="stop-color:rgb(39,35,97); stop-opacity:1" />
        <stop offset="72%" style="stop-color:rgb(102,47,143); stop-opacity:1" />
      </linearGradient>
    </defs>

    <g class="head">
      <path fill="#8bc540" class="head_hair" d="M 315 302 a 50 45 0 0 1 -15 -80 a 45 50 0 0 1 75 -5 a 50 50 0 0 1 0 83 v -60 q 0 -15 -10 -15 q 5 0 5 15 c 0 -20 -40 0 -40 -25 a 15 15 0 0 0 -15 15 z"></path>
      <path fill="#000000" class="head_eye" d="M 345 246 c -5 30 12 33 10 7 z"></path>
      <path fill="#000000" class="head_eye" d="M 369 250 c 5 30 -12 27 -8 5 z"></path>
      <path fill="#ec2024" class="head_mouth" d="M 320 267 a 3 3 0 0 1 5 -5 q 20 25 44 16 a 2 2 0 0 1 3 3 q -25 15 -52 -14"></path>
    </g>

    <g class="body">

      <g class="hand_up">
        <path fill="#272361" class="hand_up-paw" d="M 525 330 c -5 -10 -40 -20 -20 -40 c -10 -60 10 -60 10 -5 q 6 -1 12 -2 q 5 -8 12 -2 c 20 0 25 20 20 30 c 3 30 -30 30 -34 19"></path>
        <path fill="#662f8f" d="M 495 390 c 60 25 45 0 30 -60 l 37 -10 c 15 90 0 130 -77 85"></path>
        <circle fill="#ffffff" cx="539" cy="337" r="5"></circle>
      </g>

      <g class="torso">
        <path fill="#8955b7" d="M 275 330 h 100 v 190 h -100 z"></path>
        <path fill="#0b0b2b" d="M 275 520 h 100 v 50 h -100 z"></path>
        <path fill="#472164" d="M 220 330 h 85 a 25 25 0 0 1 25 25 v 165 h -135 v -165 a 25 25 0 0 1 25 -25"></path>
        <path fill="#1b1844" d="M 195 520 h 135 v 25 a 25 25 0 0 1 -25 25 h -85 a 25 25 0 0 1 -25 -25 z"></path>
        <path fill="#662f8f" d="M 355 330 h 115 a 25 25 0 0 1 25 25 v 165 h -165 v -165 a 25 25 0 0 1 25 -25"></path>
        <path fill="#272361" d="M 330 520 h 165 v 25 a 25 25 0 0 1 -25 25 h -115 a 25 25 0 0 1 -25 -25 z"></path>
        <path fill="#272361" d="M 355 330 l 15 40 l -30 15 l 42 95 v 80 h 66 v -80 l 36 -93 l -27 -17 l 14 -40"></path>
        <path fill="#4c8e25" d="M 382 330 v 170 h 18 l 18 -25 16 25 h 14 v -170"></path>
      </g>

      <g class="hand_down">
        <path fill="#662f8f" d="M 260 380 c 10 3 15 20 0 20 c -15 0 -86 -20 -86 0 c -5 5 -8 56 -3 75 h -42 c 0 -50 10 -100 35 -100 q 43 -10 97 5"></path>
        <path fill="#272361" d="M 170 475 c 15 35 -15 65 -20 50 q -8 7 -13 -5 q -8 7 -10 -8 c -10 0 -10 -30 2 -30 v -7 z"></path>
        <circle fill="#ffffff" cx="140" cy="463" r="5"></circle>
      </g>
    </g>

    <g class="legs">
      <path class="leg" fill="url(#joker-shoes)" d="M 350 570 c 15 25 10 40 -22 85 q -10 15 60 9 c 15 0 -10 -15 -21 -26 q 15 -34 -3 -68"></path>
      <path class="leg" fill="url(#joker-shoes)" d="M 350 570 c 15 25 10 40 -22 85 q -10 15 60 9 c 15 0 -10 -15 -21 -26 q 15 -34 -3 -68"></path>
    </g>

  </g>

  <g class="batman">

    <defs>
      <linearGradient id="batman-shoes" x1="0%" y1="0%" x2="0%" y2="100%">
        <stop offset="38%" style="stop-color:rgb(77,77,77); stop-opacity:1" />
        <stop offset="42%" style="stop-color:rgb(0,0,0); stop-opacity:1" />
      </linearGradient>
      <linearGradient id="hand1" x1="0%" y1="0%" x2="0%" y2="100%">
        <stop offset="45%" style="stop-color:rgb(0,0,0); stop-opacity:1" />
        <stop offset="50%" style="stop-color:rgb(77,77,77); stop-opacity:1" />
      </linearGradient>
      <linearGradient id="hand2" x1="0%" y1="0%" x2="0%" y2="100%">
        <stop offset="55%" style="stop-color:rgb(77,77,77); stop-opacity:1" />
        <stop offset="60%" style="stop-color:rgb(0,0,0); stop-opacity:1" />
      </linearGradient>
    </defs>

    <g class="head">
      <path fill="#db9b93" class="head_face" d="M 320 390 v -120 h 55 v 120 h -55"></path>
      <path fill="#000000" class="head_mask" d="M 315 350 v -160 l 12 24 q 10 -6 20 -5 v -25 l 15 30 c 5 0 14 14 14 25 v 35 h -12 l -6 20 l -6 -20h -28 v 76 z"></path>
      <ellipse fill="#ffffff" class="head_eye" cx="350" cy="251" rx="5" ry="12"></ellipse>
      <ellipse fill="#ffffff" class="head_eye" cx="364" cy="251" rx="5" ry="12"></ellipse>
    </g>

    <g class="body">

      <g class="hand_up">
        <path fill="#000000" class="hand_up-paw" d="M 525 330 c -5 -10 -40 -20 -20 -40 c -10 -60 10 -60 10 -5 q 6 -1 12 -2 q 5 -8 12 -2 c 20 0 25 20 20 30 c 3 30 -30 30 -34 19"></path>
        <path fill="url(#hand1)" d="M 495 390 c 60 25 45 0 30 -60 l 37 -10 c 15 90 0 130 -77 85"></path>
      </g>

      <g class="torso">
        <path fill="#000000" d="M 275 520 h 100 v 50 h -100 z"></path>
        <path fill="#363636" d="M 220 330 h 85 a 25 25 0 0 1 25 25 v 128 h -135 v -128 a 25 25 0 0 1 25 -25"></path>
        <path fill="#b2a800" d="M 195 483 h 135 v 27 h -135 z"></path>
        <path fill="#363636" d="M 195 510 h 135 v 35 a 25 25 0 0 1 -25 25 h -85 a 25 25 0 0 1 -25 -25 z"></path>
        <path fill="#4d4d4d" d="M 355 330 h 115 a 25 25 0 0 1 25 25 v 128 h -165 v -128 a 25 25 0 0 1 25 -25"></path>
        <path fill="#fff100" d="M 330 483 h 165 v 27 h -165 z"></path>
        <path fill="#4d4d4d" d="M 330 510 h 165 v 35 a 25 25 0 0 1 -25 25 h -115 a 25 25  0 0 1 -25 -25 z"></path>
        <path fill="#000000" d="M 30 305 q 10 35 165 25 h 275 a 25 25 0 0 1 25 25 v 25 l -80 -50 l -85 47 l -50 -17 q -250 10 -250 -55"></path>

        <ellipse fill="#fff100" stroke="#000000" stroke-width="2px" cx="416" cy="497" rx="29" ry="19"></ellipse>
        <path fill="#000000" d="M 417 425 c 0 -10 16 -25 16 -10 c 20 -20 20 5 10 10 c 30 -10 30 -45 -7 -55 c 10 20 -15 30 -13 -3 q -6 10 -12 0 c 2 23 -23 33 -13 3 c -37 10 -37 45 -7 55 c -10 -5 -10 -30 10 -10 c 0 -15 16 0 16 10"></path>
        <path fill="#000000" style="transform: scale(0.5); transform-origin: 415px 495px;" d="M 417 525 c 0 -10 16 -25 16 -10 c 20 -20 20 5 10 10 c 30 -10 30 -45 -7 -55 c 10 20 -15 30 -13 -3 q -6 10 -12 0 c 2 23 -23 33 -13 3 c -37 10 -37 45 -7 55 c -10 -5 -10 -30 10 -10 c 0 -15 16 0 16 10"></path>
      </g>

      <g class="hand_down">
        <path fill="url(#hand2)" d="M 260 380 c 10 3 15 20 0 20 c -15 0 -86 -20 -86 0 c -5 5 -8 56 -3 75 h -42 c 0 -50 10 -100 35 -100 q 43 -10 97 5"></path>
        <path fill="#000000" d="M 170 475 c 15 35 -15 65 -20 50 q -8 7 -13 -5 q -8 7 -10 -8 c -10 0 -10 -30 2 -30 v -7 z"></path>
      </g>
    </g>

    <g class="legs">
      <path class="leg" fill="url(#batman-shoes)" d="M 350 570 c 15 25 10 40 -22 85 q -10 15 60 9 c 15 0 -10 -15 -21 -26 q 15 -34 -3 -68"></path>
      <path class="leg" fill="url(#batman-shoes)" d="M 350 570 c 15 25 10 40 -22 85 q -10 15 60 9 c 15 0 -10 -15 -21 -26 q 15 -34 -3 -68"></path>
    </g>

  </g>

</svg>
              
            
!

CSS

              
                svg {
  max-height: 100vh;
}

$speed: 3s;

.legs {
  animation: legs calc(#{$speed} / 8) infinite alternate;
  transform-origin: 0 670px;
}

.leg {
  animation: leg $speed infinite linear;
  transform-origin: 305px 610px;

  &:nth-child(2) {
    animation-delay: calc(#{$speed} / -2);
  }
}

.body {
  animation: jump calc(#{$speed} / 8) infinite alternate;
}

.head_hair,
.head_mask {
  animation: jump calc(#{$speed} / 8) calc(#{$speed} / 80) infinite alternate;
}

.head_eye,
.head_mouth {
  animation: jump calc(#{$speed} / 8) calc(#{$speed} / 60) infinite alternate;
}

.hand_down {
  animation: rotatehand calc(#{$speed} / 8) calc(#{$speed} / 20) infinite alternate ease-in-out;
  transform-origin: 265px 385px;
}

.hand_up {
  animation: rotatehand calc(#{$speed} / 8) calc(#{$speed} / 20) infinite alternate ease-in-out;
  transform-origin: 465px 385px;

  &-paw {
    animation: rotatehand calc(#{$speed} / 16) infinite alternate ease-in-out;
    transform-origin: 545px 325px;
  }
}

.joker {
  animation: joker calc(#{$speed} * 4) calc(#{$speed} / -8) infinite linear;
  transform-origin: 345px 0px;
}

.batman {
  animation: batman calc(#{$speed} * 4) calc(#{$speed} / -8) infinite linear;
  transform-origin: 345px 0px;
}

@keyframes legs {
  from {
    transform: scale(1, 0.75);
  }
  to {
    transform: scale(1);
  }
}

@keyframes jump {
  from {
    transform: translateY(30px);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes rotatehand {
  from {
    transform: rotate(-5deg);
  }
  to {
    transform: rotate(5deg);
  }
}

@keyframes joker {
  0%, 100% { transform: translateX(0px); }
  49% { transform: translateX(300px); }
  50% { transform: translateX(300px) scale(-1, 1); }
  99% { transform: translateX(0px) scale(-1, 1); }
}

@keyframes batman {
  0%, 100% { transform: translateX(600px); }
  49% { transform: translateX(900px); }
  50% { transform: translateX(900px) scale(-1, 1); }
  99% { transform: translateX(600px) scale(-1, 1); }
}

@keyframes leg {
  0%, 100% { transform: translateX(65px) scale(1.1); }
  85% { transform: translateX(-65px) scale(1); }
}

              
            
!

JS

              
                
              
            
!
999px

Console