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

              
                <div class="message">
  &check; Made by <a href="https://codepen.io/pieter-biesemans/" target="_blank" title="&check; check out my other work">Pieter Biesemans</a> with &#9749;, &#128420; &amp; &#8986;</i>
</div>

<div class="wrapper">
  <div class="score left"></div>
  <div class="paddle left"></div>
  <div class="middle"></div>
  <div class="paddle right"></div>
  <div class="score right"></div>
  <div class="ball"></div>
  
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Press+Start+2P');

div{
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overflow: visible;
}

body{
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  color: white;
  font-family: 'Press Start 2P', cursive;
  font-size: 1vmin;
  background: black;
  
  & .wrapper{
    top: 50%;
    left: 50%;
    width: 75vmin;
    height: 75vmin;
    transform: translate(-50%, -50%);
    
    & .middle{
      top: 50%;
      left: 50%;
      width: 1vmin;
      height: 100%;
      border-right: 1vmin dashed white;
      transform:translate(-50%, -50%) rotate(0deg);
      transform-origin: center center;
      animation: middle 10s 0s ease alternate infinite;
    }
    
    & .paddle{
      top: 0;
      width: 50%;
      height: 25%;
      transform:translatY(0) rotate(0deg);
      &.left{
        left: 0;
        border-left: 1vmin solid white;
        transform-origin: right center;
        animation: paddleleft 10s 0s ease alternate infinite;
      }
      &.right{
        right: 0;
        border-right: 1vmin solid white;
        transform-origin: left center;
        animation: paddleright 10s 0s ease alternate infinite;
      }
    }
    
    & .ball{
      width: 1vmin;
      height: 1vmin;
      background: white;
      transform-origin: center center;
      animation: ball 10s 0s linear alternate infinite;
    }
    
    & .score{
      top: -10vmin;
      left: calc(50% - 12vmin);
      width: 10vmin;
      height: 10vmin;
      font-size: 8em;
      &:before{
        display: block;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        text-align: center;
      }
      &.left{
        left: calc(50% - 12vmin);
        &:before{
          content: '0';
          animation: scoreleft 10s 0s ease alternate infinite;
        }
      }
      &.right{
        left: calc(50% + 2vmin);
        &:before{
          content: '0';
          animation: scoreright 10s 0s ease alternate infinite;
        }
      }
    }
    
  }
  
  & .message{
    position: absolute;
    right:  0.5vw;
    bottom: 1vw;
    max-width: 90vw;
    font-size: 1.5em;
    color: white;

    & a{
      color: inherit;
      text-decoration: none;
      border-bottom: 1px solid #444;
      &:hover{
        border-width: 3px;
      }
    }

  }
  
}

@keyframes middle {
  0%   {height:100%;transform:translate(-50%,-50%) rotate(0deg);}
  20%  {height:100%;transform:translate(-50%,-50%) rotate(0deg);}
  30%  {height:100%;transform:translate(-50%,-50%) rotate(0deg);}
  40%  {height:75%;transform:translate(-50%,-50%) rotate(-90deg);}
  50%  {height:20%;transform:translate(-50%,-50%) rotate(-360deg);}
  60%  {height:60%;transform:translate(-50%,-50%) rotate(90deg);}
  70%  {height:50%;transform:translate(-50%,-50%) rotate(270deg);}
  80%  {height:10%;transform:translate(-50%,-50%) rotate(-90deg);}
  90%  {height:40%;transform:translate(-50%,-50%) rotate(90deg);}
  100% {height:90%;transform:translate(-50%,-50%) rotate(360deg);}
}

@keyframes ball {
  0%   {top:0;left:50%;width:1vw;}
  10%  {top:0;left:50%;width:1vw;}
  20%  {top:40%;left:100%;width:1vw;}
  30%  {top:80%;left:0%;width:1vw;}
  40%  {top:80%;left:100%;width:1vw;}
  50%  {top:0%;left:50%;width:1vw;}
  60%  {top:100%;left:50%;width:1vw;}
  70%  {top:50%;left:100%;width:1vw;}
  80%  {top:0%;left:50%;width:1vw;}
  90%  {top:50%;left:0%;width:1vw;}
  100% {top:50%;left:100%;width:1vw;}
}

@keyframes paddleleft{
  0%   {top:50%;height:25%;transform:translateY(0) rotate(0deg);}
  20%  {top:40%;height:25%;transform:translateY(0) rotate(0deg);}
  30%  {top:60%;height:25%;transform:translateY(0) rotate(0deg);}
  40%  {top:50%;height:25%;transform:translateY(-50%) rotate(0deg);}
  50%  {top:50%;height:45%;transform:translateY(-50%) rotate(90deg);}
  60%  {top:50%;height:65%;transform:translateY(-50%) rotate(180deg);}
  70%  {top:50%;height:15%;transform:translateY(-50%) rotate(-180deg);}
  80%  {top:50%;height:10%;transform:translateY(-50%) rotate(360deg);}
  90%  {top:50%;height:50%;transform:translateY(-50%) rotate(0deg);}
  100% {top:50%;height:5%;transform:translateY(-50%) rotate(-90deg);}
}

@keyframes paddleright{
  0%   {top:50;height:25%;transform:translateY(0) rotate(0deg);}
  20%  {top:30%;height:25%;transform:translateY(0) rotate(0deg);}
  30%  {top:40%;height:25%;transform:translateY(0) rotate(0deg);}
  40%  {top:80%;height:25%;transform:translateY(-50%) rotate(0deg);}
  50%  {top:50%;height:15%;transform:translateY(-50%) rotate(-180deg);}
  60%  {top:50%;height:5%;transform:translateY(-50%) rotate(90deg);}
  70%  {top:50%;height:65%;transform:translateY(-50%) rotate(270deg);}
  80%  {top:50%;height:10%;transform:translateY(-50%) rotate(-90deg);}
  90%  {top:50%;height:40%;transform:translateY(-50%) rotate(90deg);}
  100% {top:50%;height:95%;transform:translateY(-50%) rotate(0deg);}
}

@keyframes scoreleft{
  0%   {content:'0';}
  20%  {content:'0';}
  30%  {content:'0';}
  40%  {content:'0';}
  50%  {content:'?';}
  60%  {content:'wait';}
  70%  {content:'what?';}
  80%  {content:'eh';}
  90%  {content:':o';}
  100% {content:':~';}
}

@keyframes scoreright{
  0%   {content:'0';}
  20%  {content:'0';}
  30%  {content:'0';}
  40%  {content:'0';}
  50%  {content:'!';}
  60%  {content:'';}
  70%  {content:'';}
  80%  {content:'';}
  90%  {content:'';}
  100% {content:'';}
}
              
            
!

JS

              
                /*
This Codepen is in the Public Domain.
You can use it for whatever purpose you like, except evil.
*/
              
            
!
999px

Console