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

              
                <link href="https://fonts.googleapis.com/css?family=Press+Start+2P" rel="stylesheet">

<button id="button" class="button">Start</button>

<div class="background"></div>

<div id="background-circle-overlay" class="background-circle-overlay background-circle-overlay--hide"></div>

<div id="background-overlay" class="background-overlay background-overlay--clear"></div>

<div id="text-overlay" class="text-overlay text-overlay--hide"></div>

<div class="scene-wrapper">

<div id="scene" class="scene scene--start">
  
  <div class="ring">
    
    <div class="floor">
      <div class="face face--top"></div>
      <div class="face face--front"></div>
      <div class="face face--back"></div>
      <div class="face face--left"></div>
      <div class="face face--right"></div>
    </div>
 
    <div class="rope rope--top"></div>  
    <div class="rope rope--middle"></div>
    <div class="rope rope--bottom"></div>
    
    <div class="post post--top-left">
      <div class="face face--top"></div>
      <div class="face face--front"></div>
      <div class="face face--back"></div>
      <div class="face face--left"></div>
      <div class="face face--right"></div>
    </div>

    <div class="post post--top-right">
      <div class="face face--top"></div>
      <div class="face face--front"></div>
      <div class="face face--back"></div>
      <div class="face face--left"></div>
      <div class="face face--right"></div>
    </div>

    <div class="post post--bottom-left">
      <div class="face face--top"></div>
      <div class="face face--bottom"></div>
      <div class="face face--front"></div>
      <div class="face face--back"></div>
      <div class="face face--left"></div>
      <div class="face face--right"></div>
    </div>

    <div class="post post--bottom-right">
      <div class="face face--top"></div>
      <div class="face face--bottom"></div>
      <div class="face face--front"></div>
      <div class="face face--back"></div>
      <div class="face face--left"></div>
      <div class="face face--right"></div>
    </div>

    <div id="andy" class="andy">
      <div id="andy-speach" class="andy__speach"></div>
      <div class="andy__upper-body">
        <div class="andy__head">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
        <div class="andy__body">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
        <div class="andy__arm andy__arm--left">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
        <div class="andy__arm andy__arm--right">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
      </div>
      <div class="andy__leg andy__leg--left">
        <div class="face face--top"></div>
        <div class="face face--bottom"></div>
        <div class="face face--front"></div>
        <div class="face face--back"></div>
        <div class="face face--left"></div>
        <div class="face face--right"></div>
      </div>
      <div class="andy__leg andy__leg--right">
        <div class="face face--top"></div>
        <div class="face face--bottom"></div>
        <div class="face face--front"></div>
        <div class="face face--back"></div>
        <div class="face face--left"></div>
        <div class="face face--right"></div> 
      </div>
    </div>
    
    <div id="jerry" class="jerry">
      <div id="jerry-speach" class="andy__speach"></div>
      <div class="jerry__upper-body">
        <div class="jerry__head">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
        <div class="jerry__body">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
        <div class="jerry__arm jerry__arm--left">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
        <div class="jerry__arm jerry__arm--right">
          <div class="face face--top"></div>
          <div class="face face--bottom"></div>
          <div class="face face--front"></div>
          <div class="face face--back"></div>
          <div class="face face--left"></div>
          <div class="face face--right"></div>
        </div>
      </div>
      <div class="jerry__leg jerry__leg--left">
        <div class="face face--top"></div>
        <div class="face face--bottom"></div>
        <div class="face face--front"></div>
        <div class="face face--back"></div>
        <div class="face face--left"></div>
        <div class="face face--right"></div>
      </div>
      <div class="jerry__leg jerry__leg--right">
        <div class="face face--top"></div>
        <div class="face face--bottom"></div>
        <div class="face face--front"></div>
        <div class="face face--back"></div>
        <div class="face face--left"></div>
        <div class="face face--right"></div> 
      </div>
    </div>
    
  </div>

</div>
  
</div>

<div id="secret" class="secret"></div>
              
            
!

CSS

              
                @mixin pivot(){
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 50%;
  transform-style: preserve-3d;
}

@mixin face(
  $texture,
  $texture-position,
  $height,
  $width
){
  backface-visibility: hidden;
  background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1678849/' + $texture);
  background-position: $texture-position;
  height: $height;
  position: absolute;
  transform-style: preserve-3d;
  width: $width;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: pixelated;
}

@mixin box(
  $depth: 128px,
  $height: 128px,
  $pivot-position-x: "center",
  $pivot-position-y: "center",
  $pivot-position-z: "center",
  $texture: 'box-placeholder.jpg',
  $texture-position-default: 0 0,
  $texture-position-top: $texture-position-default,
  $texture-position-bottom: $texture-position-default,
  $texture-position-left: $texture-position-default,
  $texture-position-right: $texture-position-default,
  $texture-position-front: $texture-position-default,
  $texture-position-back: $texture-position-default,
  $width: 128px,
  $top-x: 0,
  $bottom-x: 0,
  $sides-x: 0,
  $top-y: 0,
  $bottom-y: 0,
  $sides-y: 0,
  $top-z: 0,
  $bottom-z: 0,
  $sides-z: 0,
){
  @if($pivot-position-z == 'top'){
    $top-z: 0;
    $bottom-z: - $depth;
    $sides-z: - $depth /2;
  }@else if($pivot-position-z == 'center'){
    $top-z: $depth / 2;
    $bottom-z: - $depth / 2;
    $sides-z: 0;
  }@else{
    $top-z: $depth;
    $bottom-z: 0;
    $sides-z: $depth /2;
  }

  @if($pivot-position-y == 'top'){
    $top-y: 0;
    $bottom-y: 0;
    $sides-y: calc( -50% + #{$height / 2});
  }@else if($pivot-position-y == 'center'){
    $top-y: -50%;
    $bottom-y: -50%;
    $sides-y: -50%;
  }@else{
    $top-y: -$height;
    $bottom-y: -$height;
    $sides-y: calc( -50% - #{$height / 2});
  }

  @if($pivot-position-x == 'left'){
    $top-x: 0;
    $bottom-x: 0;
    $sides-x: calc( -50% + #{$width / 2});
  }@else if($pivot-position-x == 'center'){
    $top-x: -50%;
    $bottom-x: -50%;
    $sides-x: -50%;
  }@else{
    $top-x: -$width;
    $bottom-x: -$width;
    $sides-x: calc( -50% - #{$width / 2});
  }

  @include pivot;

  .face--top{
    @include face($texture, $texture-position-top, $height, $width);
    transform: translate3d($top-x, $top-y, $top-z);
  }

  .face--bottom{
    @include face($texture, $texture-position-bottom, $height, $width);
    transform: translate3d($bottom-x, $bottom-y, $bottom-z) rotateX(180deg);
  }

  .face--front{
    @include face($texture, $texture-position-front, $depth, $width);
    transform: translate3d($sides-x, $sides-y, $sides-z)
    translateY( $height / 2 )
    rotateX(270deg);
  }

  .face--back{
    @include face($texture, $texture-position-back, $depth, $width);
    transform: translate3d($sides-x, $sides-y, $sides-z)
    translateY( -$height / 2 )
    rotateX(270deg)
    rotateY(180deg);
  }

  .face--left {
    @include face($texture, $texture-position-left, $depth, $height);
    transform: translate3d($sides-x, $sides-y, $sides-z)
    translateX( $width / 2 )
    rotateX(270deg)
    rotateY(90deg);
  }

  .face--right{
    @include face($texture, $texture-position-right, $depth, $height);
    transform: translate3d($sides-x, $sides-y, $sides-z)
    translateX( -$width / 2 )
    rotateX(270deg)
    rotateY(270deg);
  }

}

$floor-size: 640px;
$floor-depth: 128px;
$post-depth: $floor-depth * 2;
$rope-gap: $floor-depth / 4.5;
$post-size: 16px;
$ground-size: $floor-size + 320px;
$ground-depth: 32px;

html{
  height: 100%;
}

body {
  font-family: 'Press Start 2P';
  height: 100%;
  overflow: hidden;
  width: 100%;
}

.scene-wrapper{
  @include pivot;
  transform: translateY(-50%) translateX(-50%) scale(0.8);
  height: 100%;
  width: 100%;
  perspective: 3000;
}

//Scene

@keyframes sceneSpin{
  0%{
    transform: translateY(40px) rotateX(45deg) rotateZ(-135deg);
  }
  100%{
    transform: translateY(40px) rotateX(45deg) rotateZ(225deg);
  }
}

.scene{
  @include pivot;
  transform: rotateX(45deg) rotateZ(225deg);
  transition: transform 1000ms linear;
}

.scene--start{
  animation: sceneSpin 90s infinite linear;
}

.scene--focus-jerry{
  transform: translateY(190px) rotateX(45deg) rotateZ(225deg);
  transition: none;
}

.scene--focus-andy{
  transform: translateY(-80px) rotateX(45deg) rotateZ(225deg); 
  transition: none;
}

//Wrestling Ring

.ring{
  @include pivot;
}

.floor{
  @include box(
    $pivot-position-z: 'top',
    $depth: $floor-depth,
    $height: $floor-size,
    $width: $floor-size,
    $texture: 'ring-floor.gif',
    $texture-position-default: 0 -640px,
    $texture-position-top: 0 0,
  );
}

.post{
  @include box(
    $pivot-position-z: 'bottom',
    $depth: $post-depth,
    $height: $post-size,
    $width: $post-size,
  );
}

$ring-edge: $floor-size / 2 + $post-size / 2;

[class*="post--top"] {
  [class^="face"] {
    background: #451b1b linear-gradient(0deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%);
  }
  
  .face--top{
    background: #642626;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
  }  
}

[class*="post--bottom"] {
  [class^="face"] {
    background: #132433 linear-gradient(0deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%);
  }
  
  .face--top{
    background: #1c3348;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
  }
}

.post--top-left{
  transform: translate3d($ring-edge, -$ring-edge, -$floor-depth);
}

.post--top-right{
  transform: translate3d(-$ring-edge, -$ring-edge, -$floor-depth);
}

.post--bottom-left{
  transform: translate3d($ring-edge, $ring-edge, -$floor-depth);
}

.post--bottom-right{
  transform: translate3d(-$ring-edge, $ring-edge, -$floor-depth);
}

.rope{
  box-sizing: border-box;
  top: 0;
  left: 0;
}

.rope--bottom{
  @include face($texture: 'ropes-blue.gif', $texture-position: 0, $height: $floor-size + 16px, $width: $floor-size + 16px);
  transform: translate3d(-50%, -50%, $rope-gap); 
}

.rope--middle{
  @include face($texture: 'ropes-white.gif', $texture-position: 0, $height: $floor-size + 16px, $width: $floor-size + 16px);
  transform: translate3d(-50%, -50%, $rope-gap * 2.5); 
}

.rope--top{
  @include face($texture: 'ropes-red.gif', $texture-position: 0, $height: $floor-size + 16px, $width: $floor-size + 16px);
  transform: translate3d(-50%, -50%, $rope-gap * 4); 
}

.andy{
  @include pivot;
  transform: translateZ($floor-depth / 2);
}

.andy__upper-body{
  @include pivot;
}

.andy__speach{
  opacity: 0;
  transition: opacity 150ms linear;
}

.andy__speach:not(:empty){
  background-color: rgba(255,255,255,0.6);
  border-radius: 20px;
  padding: 20px;
  @include pivot;
  transform: scaleZ(1.5) translateX(-50%) translateY(-50%) translateZ(150px) rotateY(-90deg) rotateX(90deg) rotateZ(90deg);
  line-height: 1.6;
  min-width: 200px;
  text-align: center;
  opacity: 1;
}

.andy__head{
  @include box(
    $pivot-position-z: 'bottom',
    $depth: 28px,
    $height: 28px,
    $width: 28px,
    $texture: 'andy-kaufman.gif',
    $texture-position-top: -28px 0,
    $texture-position-front: 0 0,
    $texture-position-back: -28px -28px,
    $texture-position-left:  0 -28px,
    $texture-position-right: -56px -28px
  );
  transform: translateZ(54px);
  transition: transform 200ms linear;
}

.andy__body{
  @include box(
    $pivot-position-z: 'top',
    $depth: 48px,
    $height: 24px,
    $width: 32px,
    $texture: 'andy-kaufman.gif',
    $texture-position-default: -32px -56px,
    $texture-position-back: 0 -56px,
  );
  transform: translateZ(52px);
  transition: transform 200ms linear;
}

.andy__leg{
  @include box(
    $pivot-position-z: 'top',
    $depth: 52px,
    $height: 16px,
    $width: 16px,
    $texture: "andy-kaufman.gif",
    $texture-position-default: -80px -56px,
    $texture-position-top: -0 -93px,
    $texture-position-bottom: -56px -12px,
    $texture-position-back: -64px -56px
  );
  
  transition: transform 200ms linear;
}

.andy__arm{
  @include box(
    $pivot-position-z: 'top',
    $depth: 52px,
    $height: 12px,
    $width: 12px,
    $texture: "andy-kaufman.gif",
    $texture-position-default: -84px -4px,
    $texture-position-top: -72px -16px,
    $texture-position-bottom: -72px -4px,
  );
  
  transition: transform 200ms linear;
}

.andy__arm--left{
  transform: translateX(-20px) translateZ(48px) rotateY(10deg);
}

.andy__arm--right{
  transform: translateX(20px) translateZ(48px) rotateY(-10deg);
}

.andy__leg--left{
  transform: translateX(-8px);
}

.andy__leg--right{
  transform: translateX(8px);
}

.andy--walking{
  .andy__arm--left{
    animation: andyArmLeftWalk 300ms infinite;
  }
  .andy__arm--right{
    animation: andyArmRightWalk 300ms infinite;
  }
  .andy__leg--left{
    animation: andyLegLeftWalk 300ms infinite;
  }
  .andy__leg--right{
    animation: andyLegRightWalk 300ms infinite;
  }
}

@keyframes andyArmLeftWalk {
  0%{ transform: translateX(-20px) translateZ(48px) rotateX(20deg) rotateY(10deg); }
  50%{ transform: translateX(-20px) translateZ(48px) rotateX(-20deg) rotateY(10deg); }
  100%{ transform: translateX(-20px) translateZ(48px) rotateX(20deg) rotateY(10deg); }
}

@keyframes andyArmRightWalk {
  0%{ transform: translateX(20px) translateZ(48px) rotateX(-20deg) rotateY(-10deg); }
  50%{ transform: translateX(20px) translateZ(48px) rotateX(20deg) rotateY(-10deg); }
  100%{ transform: translateX(20px) translateZ(48px) rotateX(-20deg) rotateY(-10deg); }
}

@keyframes andyLegLeftWalk {
  0%{ transform: translateX(-8px) rotateX(-30deg); }
  50%{ transform: translateX(-8px) rotateX(30deg); }
  100%{ transform: translateX(-8px) rotateX(-30deg); }
}

@keyframes andyLegRightWalk {
  0%{ transform: translateX(8px) rotateX(30deg); }
  50%{ transform: translateX(8px) rotateX(-30deg); }
  100%{ transform: translateX(8px) rotateX(30deg); }
}

// Jerry

.jerry{
  @include pivot;
  transform: translateZ($floor-depth / 2);
  // transition: transform 400ms linear;
}

.jerry__upper-body{
  @include pivot;
}

.jerry__head{
  @include box(
    $pivot-position-z: 'bottom',
    $depth: 28px,
    $height: 28px,
    $width: 28px,
    $texture: 'jerry-lawler.gif',
    $texture-position-top: -52px -76px,
    $texture-position-front: -52px -76px,
    $texture-position-back: -80px -104px,
    $texture-position-left:  -52px -104px,
    $texture-position-right: -108px -104px
  );
  transform: translateZ(54px);
  transition: transform 200ms linear;
}

.jerry__body{
  @include box(
    $pivot-position-z: 'top',
    $depth: 47px,
    $height: 31px,
    $width: 52px,
    $texture: 'jerry-lawler.gif',
    $texture-position-top: 0 0,
    $texture-position-front: 0 -80px,
    $texture-position-back: 0 -33px,
    $texture-position-left:  -52px 0,
    $texture-position-right: -84px 0
  );
  transform: translateZ(52px);
  transition: transform 200ms linear;
  
  .face--bottom{
    background: #c43939;
  }
}

.jerry__leg{
  @include box(
    $pivot-position-z: 'top',
    $depth: 52px,
    $height: 20px,
    $width: 20px,
    $texture: 'jerry-lawler.gif',
    $texture-position-default: -116px -52px,
    $texture-position-top: -116px -48px,
    $texture-position-bottom: -76px -48px
  );
  
  transition: transform 200ms linear;
}

.jerry__arm{
  @include box(
    $pivot-position-z: 'top',
    $depth: 52px,
    $height: 20px,
    $width: 20px,
    $texture: 'jerry-lawler.gif',
    $texture-position-default: -116px 0,
    $texture-position-top: -52px -48px,
    $texture-position-bottom: -52px -48px
  );
  
  transition: transform 200ms linear;
}

.jerry__arm--left{
  transform: translateX(-32px) translateZ(48px);
}

.jerry__arm--right{
  transform: translateX(32px) translateZ(48px);
}

.jerry__leg--left{
  transform: translateX(-10px);
}

.jerry__leg--right{
  transform: translateX(10px);
}

.jerry--walking{
  .jerry__arm--left{
    animation: jerryArmLeftWalk 300ms infinite;
  }
  .jerry__arm--right{
    animation: jerryArmRightWalk 300ms infinite;
  }
  .jerry__leg--left{
    animation: jerryLegLeftWalk 300ms infinite;
  }
  .jerry__leg--right{
    animation: jerryLegRightWalk 300ms infinite;
  }
}

@keyframes jerryArmLeftWalk {
  0%{ transform: translateX(-32px) translateZ(48px) rotateX(20deg); }
  50%{ transform: translateX(-32px) translateZ(48px) rotateX(-20deg); }
  100%{ transform: translateX(-32px) translateZ(48px) rotateX(20deg); }
}

@keyframes jerryArmRightWalk {
  0%{ transform: translateX(32px) translateZ(48px) rotateX(-20deg); }
  50%{ transform: translateX(32px) translateZ(48px) rotateX(20deg); }
  100%{ transform: translateX(32px) translateZ(48px) rotateX(-20deg); }
}

@keyframes jerryLegLeftWalk {
  0%{ transform: translateX(-10px) rotateX(-30deg); }
  50%{ transform: translateX(-10px) rotateX(30deg); }
  100%{ transform: translateX(-10px) rotateX(-30deg); }
}

@keyframes jerryLegRightWalk {
  0%{ transform: translateX(10px) rotateX(30deg); }
  50%{ transform: translateX(10px) rotateX(-30deg); }
  100%{ transform: translateX(10px) rotateX(30deg); }
}

.use-transition *{
  transition: transform 400ms linear;
}

.jerry--headlock{
  .jerry__upper-body{
    transform: rotateX(50deg);
  }
  .jerry__arm--left{
    transform: translateX(-32px) translateZ(48px) rotateX(20deg) rotateY(-20deg);
  }
  .jerry__arm--right{
    transform: translateX(32px) translateZ(48px) rotateX(20deg) rotateY(20deg);
  }
}

.andy--headlock{
  transform: translateZ($floor-depth / 2) translateX(-30px) translateY(-40px) rotateX(0deg)!important;
  
  .andy__arm--right{
    transform: translateX(20px) translateZ(48px) rotateZ(-10deg) rotateY(-90deg);
  }
}

@keyframes AndySuplexArmRight{
  0%{ transform: translateX(20px) translateZ(48px) rotateZ(-10deg) rotateY(-90deg); }
  40%{ transform: translateX(20px) translateZ(48px) rotateZ(-10deg) rotateY(-90deg); }
  60%{ transform: translateX(20px) translateZ(48px) rotateZ(-10deg) rotateY(-10deg); }
  100%{ transform: translateX(20px) translateZ(48px) rotateZ(-10deg) rotateY(-10deg); }
}

@keyframes AndySuplexUpperBody{
  0%{transform: rotateX(0deg);}
  50%{transform: rotateX(0deg);}
  100%{transform: rotateX(90deg);}
}

@keyframes AndySuplex {
  0%{  transform: translateZ($floor-depth / 2) translateX(-30px) translateY(-40px) rotateX(0deg) }
  40%{  transform: translateZ($floor-depth / 2) translateX(-30px) translateY(-40px) rotateX(0deg) }
  50%{  transform: translateZ($floor-depth / 2 + 100px) translateX(-30px) translateY(50px) rotateX(-120deg) }
  70%{  transform: translateZ($floor-depth / 2 + 20px) translateX(-30px) translateY(100px) rotateX(-180deg) }
  100%{  transform: translateZ($floor-depth / 2 - 48px) translateX(-30px) translateY(100px) rotateX(-180deg) }
}

@keyframes JerrySuplexArmLeft{
  0%{ transform: translateX(-32px) translateZ(48px) rotateX(20deg) rotateY(-20deg) }
  40%{ transform: translateX(-32px) translateZ(48px) rotateX(20deg) rotateY(50deg) }
  60%{ transform: translateX(-32px) translateZ(48px) rotateX(-140deg) rotateY(0deg) }
  100%{ transform: translateX(-32px) translateZ(48px) rotateX(-140deg) rotateY(0deg) }
}

@keyframes JerrySuplexArmRight{
  0%{ transform: translateX(32px) translateZ(48px) rotateX(20deg) rotateY(20deg) }
  40%{ transform: translateX(32px) translateZ(48px) rotateX(-140deg) rotateY(45deg) }
  60%{ transform: translateX(32px) translateZ(48px) rotateX(-140deg) rotateY(-10deg) }
  100%{ transform: translateX(32px) translateZ(48px) rotateX(-140deg) rotateY(-10deg) }
}

@keyframes JerrySuplexUpperBody{
  0%{transform: rotateX(50deg);}
  40%{transform: rotateX(50deg);}
  75%{transform: rotateX(-30deg);}
  100%{transform: rotateX(-30deg);}
}

@keyframes JerrySuplex {
  0%{  transform: translateZ($floor-depth / 2) rotateX(0deg) }
  40%{  transform: translateZ($floor-depth / 2) rotateX(0deg) }
  60%{  transform: translateZ($floor-depth / 2 - 20px) rotateX(-90deg) }
  100%{  transform: translateZ($floor-depth / 2 - 30px) rotateX(-90deg) }
}

@keyframes SceneSuplex {
  0%{
    transform: translateX(0) rotateX(45deg) rotateZ(225deg);
  }
  60%{
    transform: translateX(0) rotateX(45deg) rotateZ(225deg);
  }
  64%{
    transform: translateX(-5px) rotateX(45deg) rotateZ(225deg);
  }
  68%{
    transform: translateX(5px) rotateX(45deg) rotateZ(225deg);
  }
  72%{
    transform: translateX(-5px) rotateX(45deg) rotateZ(225deg);
  }
  100%{
    transform: translateX(0) rotateX(45deg) rotateZ(225deg);
  }
}

.andy--suplex{
   animation: AndySuplex 3s forwards;
   // transform: translateZ($floor-depth / 2);
  
  .andy__upper-body{
    animation: AndySuplexUpperBody 3s forwards;
  }
  
  .andy__arm--right{
    animation: AndySuplexArmRight 3s forwards;
  }
}

.jerry--suplex{
   animation: JerrySuplex 3s forwards;
  
  .jerry__upper-body{
    animation: JerrySuplexUpperBody 3s forwards;
  }
  
  .jerry__arm--left{
    animation: JerrySuplexArmLeft 3s forwards;
  }
  
  .jerry__arm--right{
    animation: JerrySuplexArmRight 3s forwards;
  }
}

.scene--suplex{
  animation: SceneSuplex 3s forwards;
}

.scene--pile{
  animation: SceneSuplex 1s 2000ms forwards;
}

@keyframes AndyPile {
  0%{
    transform: translateZ(140px) translateY(-30px) rotateX(180deg) rotateZ(-180deg); 
  }
  50%{
    transform: translateZ(190px) translateY(-30px) rotateX(180deg) rotateZ(-180deg); 
  }
  80%{
    transform: translateZ(100px) translateY(-30px) rotateX(180deg) rotateZ(-180deg); 
  }
  100%{
    transform: translateZ(105px) translateY(-30px) rotateX(180deg) rotateZ(-180deg); 
  }
}

@keyframes JerryPile {
  0%{
    transform: translateZ($floor-depth / 2); 
  }
  50%{
    transform: translateZ($floor-depth / 2 + 50px);   
  }
  80%{
    transform: translateZ($floor-depth / 2 - 40px);   
  }
  100%{
    transform: translateZ($floor-depth / 2 - 35px);
  }
}

@keyframes JerryPileLegLeft {
  0%{
    transform: translateX(-10px) rotateX(0deg);
  }
  40%{
    transform: translateX(-10px) rotateX(-90deg) rotateY(20deg);
  }
  100%{
    transform: translateX(-10px) rotateX(-90deg) rotateY(20deg);
  }
}

@keyframes JerryPileLegRight {
  0%{
    transform: translateX(10px) rotateX(0deg);
  }
  40%{
    transform: translateX(10px) rotateX(-90deg) rotateY(-20deg);
  }
  100%{
    transform: translateX(10px) rotateX(-90deg) rotateY(-20deg);
  }
}

.andy--pile{
  transform: translateZ(140px) translateY(-30px) rotateX(180deg) rotateZ(-180deg) !important; 
  animation: AndyPile 1s 2000ms forwards;
  
  .andy__leg--left{
    transform: translateX(-8px) rotateY(20deg);
  }
  
  .andy__leg--right{
    transform: translateX(8px) rotateY(-20deg);
  }
}

.jerry--pile{
  transform: translateZ($floor-depth / 2) !important; 
  animation: JerryPile 1s 2000ms forwards;
  
  .jerry__arm--left{
    transform: translateX(-32px) translateZ(48px) rotateY(-30deg) rotateX(-90deg);
  }
  
  .jerry__arm--right{
    transform: translateX(32px) translateZ(48px) rotateY(30deg) rotateX(-90deg);
  }
  
  .jerry__leg--left{
    animation: JerryPileLegLeft 1s 2000ms forwards;
  }
  
  .jerry__leg--right{
    animation: JerryPileLegRight 1s 2000ms forwards;
  }
}

@keyframes blink{
  0%{color: rgba(255,255,255,1);}
  100%{color: rgba(255,255,255,0.5);}
}

.blink{
  animation: blink 1s alternate infinite;
  display: inline;
}

.background {
  background-color: #000;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: -1;
  transform: translateZ(-1000px);
}

.background-overlay {
  background-color: #000;
  position: fixed;
  left: 0;
  opacity: 1;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 1;
  transition: opacity 300ms linear;
  transform: translateZ(1000px);
}

.background-overlay--hide {
  opacity: 0;  
}

.background-overlay--clear {
  opacity: 0.8;
}

.background-circle-overlay {
  background-image: url("data:image/svg+xml,%3Csvg width='6000px' height='6000px' viewBox='0 0 6000 6000' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3C!-- Generator: Sketch 52.2 (67145) - http://www.bohemiancoding.com/sketch --%3E%3Ctitle%3ECombined Shape%3C/title%3E%3Cdesc%3ECreated with Sketch.%3C/desc%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cpath d='M0,0 L6000,0 L6000,6000 L0,6000 L0,0 Z M3000,3120 C3066.27417,3120 3120,3066.27417 3120,3000 C3120,2933.72583 3066.27417,2880 3000,2880 C2933.72583,2880 2880,2933.72583 2880,3000 C2880,3066.27417 2933.72583,3120 3000,3120 Z' id='Combined-Shape' fill='%23000000'%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
  background-size: 6000px;
  background-repeat: no-repeat;
  background-position: center;
  position: fixed;
  left: 0;
  opacity: 1;
  top: 0;
  bottom: 0;
  right: 0;
  transition: opacity 500ms linear;
  transform: translateZ(1000px);
  z-index: 1;
}

.background-circle-overlay--hide{
  opacity: 0;
}

.text-overlay {
  background-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
  box-sizing: border-box;
  font-size: 1.1rem;
  color: #fff;
  position: fixed;
  left: 50%;
  top: 50%;
  text-align: center;
  padding: 32px;
  transition: opacity 300ms linear;
  transform: translate3d(-50%, -50%, 1100px);
  line-height: 1.6;
  width: 100%;
  max-width: 720px;
  z-index: 1;
}

.text-overlay--bottom {
  font-size: 0.9rem;
  top: inherit;
  transform: translate3d(-50%, 0, 1100px);
  padding-bottom: 64px;
  bottom: 0;
}

.text-overlay--hide {
  opacity: 0;
}

.button{
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg width='157px' height='56px' viewBox='0 0 157 56' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cpath d='M150.761589,47.877551 L150.761589,44.7755102 L153.880795,44.7755102 L153.880795,6 L157,6 L157,49.877551 L153.880795,49.877551 L153.880795,52.9387755 L150.761589,52.9387755 L150.761589,56 L6.2384106,56 L6.2384106,52.9387755 L3.1192053,52.9387755 L3.1192053,49.877551 L0,49.877551 L0,6 L3.1192053,6 L3.1192053,44.7755102 L6.2384106,44.7755102 L6.2384106,47.877551 L150.761589,47.877551 Z M3,2 L6,2 L6,6 L3,6 L3,2 Z M151,2 L155,2 L155,6 L151,6 L151,2 Z M6,0 L151,0 L151,3 L6,3 L6,0 Z' id='Shape' fill='%23FFFFFF'%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
  background-size: 90%;
  background-repeat: no-repeat;
  background-position: center;
  border: 0;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  left: 50%;
  outline: none;
  position: fixed;
  top: 50%;
  transform: translate3d(-50%, -50%, 1200px);
  z-index: 3;
  height: 56px;
  width: 157px;
  font-size: 0.9rem;
  transform-origin: top left;
  transition: background-size 120ms linear, opacity 100ms linear;
  
  &:hover{
    background-size: 100%;
  }
  
  &:active{
    background-size: 95%;
  }
}

.button--hide{
  opacity: 0;
  pointer-events: none;
}

.secret{
  background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1678849/tony.gif');
  background-size: cover;
  background-repeat: no-repeat;
  position: fixed;
  bottom: -40px;
  right: -40px;
  height: 240px;
  width: 240px;
  transform: rotateZ(0deg) translate3d(100%, 100%, 1200px);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: pixelated;
  z-index: 3;
  transition: transform 3s ease-in-out;
}

.secret--shown{
  transform: rotateZ(-30deg) translate3d(0, 0, 1200px); 
}
              
            
!

JS

              
                const button = document.getElementById('button');
const scene = document.getElementById('scene');
const backgroundOverlay = document.getElementById('background-overlay');
const backgroundOverlayCircle = document.getElementById('background-circle-overlay');
const textOverlay = document.getElementById('text-overlay');
const secret =  document.getElementById('secret');

const wait = timeout => new Promise(resolve => setTimeout(resolve, timeout));

class Actor {
  constructor({ name, direction, position }) {
    this.name = name;
    this.element = document.getElementById(name);
    this.elementSpeach = document.getElementById(`${name}-speach`);
    this.direction = direction;
    this.position = position;
    this.speed = 0;
    this.speachTimeout = null;
    this.target = null;
    this.targetTimeout = null;
    this.walking = false;
  }

  setTarget({ position, range, onAcquired, onTimeout, timeout }) {
    this.target = {
      position,
      range: range || 0,
      onAcquired
    };

    if(timeout){
      this.targetTimeout = setTimeout(() => {
        onTimeout();
      }, timeout) 
    }
  }

  seekTarget() {
    const differenceX = Math.abs(this.position.x - this.target.position.x);
    const differenceY = Math.abs(this.position.y - this.target.position.y);

    if(differenceX > this.target.range || differenceY > this.target.range){
      this.speed = 20;

      this.direction = 90 + Math.atan2(
        this.target.position.y - this.position.y,  
        this.target.position.x - this.position.x
      ) * 180 / Math.PI;

      this.position.x += this.speed * Math.sin(this.direction * Math.PI / 180) / 10;
      this.position.y -= this.speed * Math.cos(this.direction * Math.PI / 180) / 10;

      if(!this.walking) this.setWalking(true);
    }else{
      this.setWalking(false);
      if (this.targetTimeout) {
        clearTimeout(this.targetTimeout);
        this.targetTimeout = null;
      }
      if(this.target.onAcquired) this.target.onAcquired();
    }
  }

  setWalking(walking) {
    if(walking) {
      this.walking = true;
      this.element.classList.add(`${this.name}--walking`);
    } else {
      this.walking = false;
      this.element.classList.remove(`${this.name}--walking`); 
    }
  }

  speak(phrase, callback) {
    this.elementSpeach.innerHTML = phrase;

    if (this.speachTimeout) {
      clearTimeout(this.speachTimeout);
      this.speachTimeout = null;
    }

    this.speachTimeout = setTimeout(() => {
      this.elementSpeach.innerHTML = "";
      if(callback) callback();
    }, 2500);
  }

  updatePosition(position) {
    if(position.x > 0) {
      this.position.x = position.x < 260 ? position.x : 260;
    }else{
      this.position.x = position.x > -260 ? position.x : -260;
    }
    if(position.y > 0) {
      this.position.y = position.y < 260 ? position.y : 260;
    }else{
      this.position.y = position.y > -260 ? position.y : -260;
    }  
  }

  updateElementStyles() {
    this.element.style.transform = `
      translate3d(${this.position.x}px, ${this.position.y}px, 64px)
      rotate(${this.direction}deg)
    `;

    this.elementSpeach.style.transform = `
      scaleZ(1.5)
      translate3d(-50%, -50%, 150px)
      rotateZ(${0 - (this.direction - 45)}deg)
      rotateX(-90deg)
      rotateY(-90deg)
    `;
  }

  update() {
    if(this.target){
      this.seekTarget(); 
    }

    this.updateElementStyles();
  }
}

class Andy extends Actor {
  constructor({ taunts, ...rest}){
    super({ ...rest });
    this.taunts = taunts;
    this.tauntIndex = 0;
  }

  taunt() {
    if(this.tauntIndex + 1 <= this.taunts.length && !jerry.offeringHeadlock){
      this.speak(this.taunts[this.tauntIndex]);  
      this.tauntIndex++;
    }
  }

  acceptHeadlock() {
    this.setTarget({
      position: {
        x: 0,
        y: 0
      },
      range: 2,
      onAcquired: async () => {
        textOverlay.classList.add('text-overlay--hide');
        this.target = null;
        this.direction = 0;
        controls.disable();
        this.element.classList.add(`${this.name}--headlock`, 'use-transition');

        await wait(2000);
        this.element.classList.remove('andy--headlock', 'use-transition');
        jerry.element.classList.remove('jerry--headlock', 'use-transition');
        scene.classList.add('scene--suplex');
        this.element.classList.add('andy--suplex');
        jerry.element.classList.add('jerry--suplex');

        await wait(3000);
        backgroundOverlay.classList.remove('background-overlay--hide');

        await wait(1000);
        scene.classList.remove('scene--suplex');
        this.element.classList.remove('andy--suplex');
        jerry.element.classList.remove('jerry--suplex');
        
        await wait(1000);
        scene.classList.add('scene--pile');
        this.element.classList.add('andy--pile');
        jerry.element.classList.add('jerry--pile');
        backgroundOverlay.classList.add('background-overlay--hide');  
        textOverlay.innerHTML = '[Commentary] "Only the second move by Lawler, and BANG goes Kaufman!"'; 
        textOverlay.classList.remove('text-overlay--hide');

        await wait(3500);
        backgroundOverlay.classList.remove('background-overlay--hide');
        textOverlay.classList.add('text-overlay--hide');

        await wait(1000);
        scene.classList.remove('scene--pile');
        this.element.classList.remove('andy--pile');
        jerry.element.classList.remove('jerry--pile');

        await wait(1000);
        scene.classList.add('scene--pile');
        this.element.classList.add('andy--pile');
        jerry.element.classList.add('jerry--pile');
        backgroundOverlay.classList.add('background-overlay--hide');
        textOverlay.innerHTML = '[Commentary] "Lawler rolling Kaufman. He\'s gonna give it to him again. He figures he\'s already lost it...."'; 
        textOverlay.classList.remove('text-overlay--hide');
 
        await wait(3500);
        backgroundOverlay.classList.remove('background-overlay--hide');  
        textOverlay.classList.add('text-overlay--hide');

        await wait(2000);
        textOverlay.innerHTML = '[Announcer] "Jerry Lawler - 6 minutes and 50 seconds, with a pile driver, has been disqualified."'; 
        textOverlay.classList.remove('text-overlay--hide');

        await wait(3000);
        textOverlay.classList.add('text-overlay--hide');

        await wait(1000);
        textOverlay.innerHTML = '[Announcer] "The winner, by disqualification - Andy Kaufman"'; 
        textOverlay.classList.remove('text-overlay--hide');
        
        await wait(3000);
        secret.classList.add('secret--shown');
        
        await wait(5000);
        secret.classList.remove('secret--shown');
      }
    });
  }
}

class Jerry extends Actor {
  constructor({ enemy, taunts, ...rest}){
    super({ ...rest });
    this.enemy = enemy;
    this.offeringHeadlock = false;
  }

  offerHeadlock() {
    this.offeringHeadlock = true;
    this.element.classList.add(`${this.name}--headlock`, 'use-transition');
  }

  chaseEnemy() {
    this.setTarget({
      position: this.enemy.position,
      range: 50,
      timeout: 20000,
      onTimeout: () => this.giveUpChasingEnemy(),
      onAcquired: () => this.giveUpChasingEnemy()
    });
  }

  giveUpChasingEnemy() {
    this.setTarget({
      position: { x: 0, y: 0 },
      range: 2, 
      onAcquired: () => {
        andy.speak('');
        this.target = null;
        this.direction = 0;
        this.speak("Are you here to wrestle or act like an ass?", () => {
          this.offerHeadlock();
          textOverlay.innerHTML = 'Lawler is offering a free headlock, Press [e] to accept';
          textOverlay.classList.remove('text-overlay--hide');
        });
      }
    });    
  }

  init() {
    this.chaseEnemy();
  }
}

class Controls {
  constructor(actor) {
    this.actor = actor;
    this.gameStarted = false;
    this.disabled = false;
    this.forwardKeyPressed = false;
    this.leftKeyPressed = false;
    this.rightKeyPressed = false;
  }

  bindEvents() {
    document.addEventListener('keydown', this.handleKeydown, true);
    document.addEventListener('keyup', this.handleKeyup, true);
  }

  unbindEvents() {
    document.removeEventListener('keydown', this.handleKeydown, true);
    document.removeEventListener('keyup', this.handleKeyup, true);
  }

  disable() {
    this.unbindEvents();
    this.disabled = true;
    this.forwardKeyPressed = false;
    this.leftKeyPressed = false;
    this.rightKeyPressed = false;
  }

  enable() {
    this.bindEvents();
    this.disabled = false;
  }

  handleKeydown = event => {
    const key = event.key.toLowerCase();
    if(key === 'w') this.forwardKeyPressed = true;
    if(key === 'a') this.leftKeyPressed = true;
    if(key === 'd') this.rightKeyPressed = true;
    if(key === ' ') this.handleStart();
    if(key === 'e' && jerry.offeringHeadlock) this.actor.acceptHeadlock();
  }

  handleKeyup = event => {
    const key = event.key.toLowerCase();
    if(event.key === 'w') this.forwardKeyPressed = false;
    if(event.key === 'a') this.leftKeyPressed = false;
    if(event.key === 'd') this.rightKeyPressed = false;
  }

  handleStart = event => {
    if(!this.gameStarted){
      this.gameStarted = true;
      textOverlay.classList.add('text-overlay--hide');
      backgroundOverlayCircle.classList.add('background-circle-overlay--hide');
      scene.classList.remove('scene--focus-andy');

      setInterval(() => {
        this.actor.taunt();
      }, 3000)

      setTimeout(() => {
        backgroundOverlayCircle.classList.remove('background-overlay-circle');
        jerry.init();  
      }, 2000);
    }
  }

  watch() {
    if(this.gameStarted){
      if(this.rightKeyPressed) this.actor.direction += 2

      if(this.leftKeyPressed) this.actor.direction -= 2

      if(this.forwardKeyPressed && this.actor.speed < 60) {
        this.actor.setWalking(true);
        this.actor.speed += 2
      }

      if(!this.forwardKeyPressed && this.actor.speed > 0) {
        this.actor.speed -= 2
      }

      if(!this.forwardKeyPressed && this.actor.speed === 0){
        this.actor.setWalking(false);
      }

      this.actor.updatePosition({
        x: this.actor.position.x + this.actor.speed * Math.sin(this.actor.direction * Math.PI / 180) / 10,
        y: this.actor.position.y - this.actor.speed * Math.cos(this.actor.direction * Math.PI / 180) / 10
      })
    }
  }

init(){
  this.bindEvents();
}
}

const andy = new Andy({
  name: 'andy',
  direction: 135,
  position: {
    x: -140, 
    y: -140,
  },
  taunts: [
    "I have the brains!",
    "I'm from Hollywood!",
    "I demand respect when I come here!",
    "I've wrestled women bigger than you Lawler...",
    "...and I mopped the floor with them!",
    "You can't touch me baby!",
    "I'll get Hollywood against you baby!"
  ]
});

const jerry = new Jerry({
  name: 'jerry', 
  enemy: andy,
  direction: -45, 
  position: {
    x: 140, 
    y: 140
  }
});

const controls = new Controls(andy);

async function start() {
  button.classList.add('button--hide');
  backgroundOverlay.classList.remove('background-overlay--clear');
  
  await wait(300);
  backgroundOverlayCircle.classList.remove('background-circle-overlay--hide');
  scene.classList.remove('scene--start');
  scene.classList.add('scene--focus-andy');
  andy.direction = -45;
  
  await wait(1000);
  textOverlay.innerHTML = 'In Memory Of Andy Kaufman';
  textOverlay.classList.remove('text-overlay--hide');

  await wait(2000);
  textOverlay.classList.add('text-overlay--hide');

  await wait(1000);  
  textOverlay.innerHTML = 'April 5th, 1982 - Memphis, Tennessee';
  textOverlay.classList.remove('text-overlay--hide');

  await wait(3000);
  textOverlay.classList.add('text-overlay--hide');

  await wait(1000);
  backgroundOverlay.classList.add('background-overlay--hide');

  await wait(800);
  textOverlay.innerHTML = '[Announcer] "From Hollywood, California... Andy Kaufman!"';
  textOverlay.classList.add('text-overlay--bottom');
  textOverlay.classList.remove('text-overlay--hide');

  await wait(3000);
  textOverlay.classList.add('text-overlay--hide');

  await wait(1000);
  textOverlay.innerHTML = '[Crowd] "Booo!"';
  textOverlay.classList.remove('text-overlay--hide');

  await wait(2000);
  textOverlay.classList.add('text-overlay--hide');
  backgroundOverlay.classList.remove('background-overlay--hide');

  await wait(3000);
  scene.classList.remove('scene--focus-andy');
  scene.classList.add('scene--focus-jerry');
  backgroundOverlay.classList.add('background-overlay--hide');

  await wait(1000);
  textOverlay.innerHTML = '[Announcer] "From Memphis, Tennessee... Jerry "The King" Lawler!"';
  textOverlay.classList.add('text-overlay--bottom');
  textOverlay.classList.remove('text-overlay--hide');

  await wait(3000);
  textOverlay.classList.add('text-overlay--hide');

  await wait(1000); 
  textOverlay.innerHTML = '[Crowd] "Cheer!"';
  textOverlay.classList.remove('text-overlay--hide');

  await wait(2000); 
  textOverlay.classList.add('text-overlay--hide');
  backgroundOverlay.classList.remove('background-overlay--hide');

  await wait(3000); 
  scene.classList.remove('scene--focus-jerry');
  scene.classList.add('scene--focus-andy');
  backgroundOverlay.classList.add('background-overlay--hide');

  await wait(1000);  
  textOverlay.innerHTML = 'Lawler is twice your weight (and better looking), Use <span class="blink">[w][a][s][d]</span> to run away! <br /><br /><span class="blink">Press [space] to begin.</span>';
  textOverlay.classList.remove('text-overlay--hide');
  controls.init();
}

button.addEventListener('click', () => start());

function animate() {
  controls.watch();
  andy.update();
  jerry.update();
  window.requestAnimationFrame(animate)
}

animate();
              
            
!
999px

Console