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="wrapper">
  <div class="main">
    <div class="inner">
      <div class="screen">
        <div class="pong">loading...</div>
      </div>
    </div>
    <div class="side"></div>
  </div>
</div>
<div class="shade"></div>
              
            
!

CSS

              
                $bodyLight:#f1ebcf;
$bodyDark:#e0d9ba;
*{
  box-sizing:border-box;
}
body{
  // padding:5em;
  background:#ddd;
  font-size:2em;
}
.wrapper{
  display:block;
  // background:red;
  perspective: 1000px;
  width:10em;
  margin:5em auto 0;
}
.main{
  width:12em;
  height:10em;
  background:$bodyLight;
  background:linear-gradient(to bottom right, $bodyLight,$bodyDark);
  border-radius:5px;
  // overflow:hidden;
  border-top:1px solid lighten($bodyLight,5%);
  border-left:1px solid lighten($bodyLight,5%);
  border-right:1px solid darken($bodyDark,5%);
  border-bottom:.1em solid darken($bodyDark,10%);
  padding:1em;
  position:relative;
  transform: rotateY(20deg) rotateZ(4deg);
  perspective: 1000px;
  &:before{
    content:'';
    display:block;
    position:absolute;
    bottom:0;
    right:1em;
    height:.5em;
    width:.2em;
    background:black;
    background:radial-gradient(circle,white 5%,lighten(green,20%) 10%,#444 100%);
    border-top:1px solid darken($bodyDark,10%);
    border-left:1px solid darken($bodyDark,10%);
    border-right:1px solid lighten($bodyLight,10%);
    animation:powerlight 1s infinite linear;
  }
  &:after{
    content:'Pong 2000';
    display:block;
    position:absolute;
    bottom:.3em;
    left:1em;
    font-family:sans-serif;
    font-weight:bold;
    font-style:italic;
    color:rgba(black,.3);
    font-size:.4em;
  }
}
.side{
  content:'';
  display:block;
  position:absolute;
  top:0%;
  right:100%;
  height:100.5%;
  width:5em;
  border-top:1px solid lighten($bodyLight,5%);
  // border-left:2px solid lighten($bodyLight,5%);
  // border-bottom:2px solid darken($bodyDark,15%);
  border-radius:.5em 0 0 .5em;
  background:linear-gradient($bodyLight,darken($bodyDark,10%));
  transform:rotateY(-60deg);// translateZ(-2.1em);
  transform-origin: 100% 0%;
}
.inner{
  height:100%;
  // border-top:1em solid $bodyDark;
  background:linear-gradient(to top left, lighten($bodyLight,5%),darken($bodyDark,10%));
  border-top:1em solid darken($bodyDark,10%);
  border-left:.3em solid darken($bodyDark,5%);
  border-right:1em solid lighten($bodyLight,2%);
  border-bottom:1em solid lighten($bodyLight,5%);
  padding:.2em .3em;
  &:before{
    box-sizing:border-box;
    content:"";
    display:block;
    // width:1em;
    height:.5em;
    position:absolute;
    bottom:-.7em;
    left:7%;
    // margin-left:-2em;
    border-top:.6em solid darken($bodyDark,20%);
    border-left:1em solid transparent;
  }
  &:after{
    content:"";
    display:block;
    width:6em;
    height:.5em;
    position:absolute;
    bottom:-.7em;
    left:40%;
    margin-left:-3em;
    background:$bodyDark;
    background:linear-gradient(to bottom, darken($bodyDark,20%), $bodyDark);
    border-right:2px solid darken($bodyDark,15%);
    border-left:.1em solid darken($bodyDark,15%);
    border-bottom:.1em solid darken($bodyDark,20%);
  }
}

.screen{
  background:black;
  height:100%;
  border-top-left-radius:3em .5em;
  border-top-right-radius:3em .5em;
  border-bottom-left-radius:3em .5em;
  border-bottom-right-radius:3em .5em;
  overflow:hidden;
  position:relative;
  padding:.3em .7em;
  &:before{
    content:'';
    display:block;
    position:absolute;
    z-index:2;
    width:100%;
    height:120%;
    top:-25%;
    left:50%;
    background:linear-gradient(to bottom,rgba(white,.5),transparent);
    transform:rotate(-15deg);
  }
}

.pong{
  padding-top:1em;
  color:rgba(white,.4);
  font-family:monospace;
  text-align:center;
}

@keyframes powerlight{
  0%{
    background:radial-gradient(circle,rgba(white,1) 5%,rgba(lighten(green,20%),1) 10%,#444 100%);
  }
  50%{
    background:radial-gradient(circle,rgba(white,0) 5%,rgba(black,.4) 10%,#444 100%);
  }
  100%{
    background:radial-gradient(circle,rgba(white,1) 5%,rgba(lighten(green,20%),1) 10%,#444 100%);
  }
}
.shade{
  position:relative;
  height:6em;
  width:12em;
  margin:0 auto;
  background:radial-gradient(rgba(black,.3),transparent 70%);
  transform: rotateX(80deg);
}

///

.pong{
  width:8em;
  height:6em;
  background:green;
}
$size:1em;
$speed:1500ms;
$green:#8cdb8b;
$black:#353c39;

$size-double:2 * $size;
$size-neg:0 - $size;

.pong{
    // margin:10em auto;
    width:8em;
    height:6em;
    background:$black;
    position:relative;
    // border:1em solid #222;
    display:block;
    overflow:hidden;
    text-indent:100%;
    box-shadow:
        inset $black 0 0 0 0,
        inset $black 0 (4 * $size-neg) 0 0,
        inset $black (0.3 * $size-neg) 0 0 0,
        inset $green $size-neg 0 0 0
    ;
    animation:paddle_one $speed infinite linear;
}

.pong:before{
    position:absolute;
    top:0;
    left:0;
    display:block;
    content:"";
    width:$size;
    height:100%;
    box-shadow:
        inset $black 0 0 0 0,
        inset $black 0 (4 * $size-neg) 0 0,
        inset $black (0.3 * $size) 0 0 0,
        inset $green $size-neg 0 0 0
    ;
    animation:paddle_two $speed infinite linear; 
}

.pong:after{
    content:"";
    display:block;
    border-radius:50%;
    position:absolute;
    left:0;
    top:0;
    width:$size;
    height:$size;
    background:$green;
    animation:ball $speed infinite linear;
}

@keyframes ball{
    0%   {
        left:0.5 * $size;
        top:0;
    }
    25%   {
        left:6.5 * $size;
        top:2 * $size;
    }
    50%   {
        left:0.5 * $size;
    }
    62.5% {
        top:5 * $size;
    }
    75%   {
        left:6.5 * $size;
        top:70%;
    }
    100%   {
        left:0.5 * $size;
        top:0%;
    }
}


@keyframes paddle_one{
    0%   {
        box-shadow:
            inset $black 0 (0.5 * $size) 0 0,
            inset $black 0 (3.5 * $size-neg) 0 0,
            inset $black (0.3 * $size-neg) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    25%   {
        box-shadow:
            inset $black 0 (1.5 * $size) 0 0,
            inset $black 0 (2.5 * $size-neg) 0 0,
            inset $black (0.3 * $size-neg) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    50%   {
        box-shadow:
            inset $black 0 0 0 0,
            inset $black 0 (4 * $size-neg) 0 0,
            inset $black (0.3 * $size-neg) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    62.5% {
        box-shadow:
            inset $black 0 $size 0 0,
            inset $black 0 (3 * $size-neg) 0 0,
            inset $black (0.3 * $size-neg) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    75%   {
        box-shadow:
            inset $black 0 (4 * $size) 0 0,
            inset $black 0 0 0 0,
            inset $black (0.3 * $size-neg) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    100%   {
        box-shadow:
            inset $black 0 (0.5 * $size) 0 0,
            inset $black 0 (3.5 * $size-neg) 0 0,
            inset $black (0.3 * $size-neg) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
}

@keyframes paddle_two{
    0%   {
        box-shadow:
            inset $black 0 0 0 0,
            inset $black 0 (4 * $size-neg) 0 0,
            inset $black (0.3 * $size) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    50%   {
        box-shadow:
            inset $black 0 (3 * $size) 0 0,
            inset $black 0 $size-neg 0 0,
            inset $black (0.3 * $size) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    62.5% {
        box-shadow:
            inset $black 0 (4 * $size) 0 0,
            inset $black 0 0 0 0,
            inset $black (0.3 * $size) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    75%   {
        box-shadow:
            inset $black 0 (2 * $size) 0 0,
            inset $black 0 (2 * $size-neg) 0 0,
            inset $black (0.3 * $size) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
    100%   {
        box-shadow:
            inset $black 0 0 0 0,
            inset $black 0 (4 * $size-neg) 0 0,
            inset $black (0.3 * $size) 0 0 0,
            inset $green $size-neg 0 0 0
        ;
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console