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

              
                <body>
  <h1 class="title">Smile and press the red button! :)</h1>
<video id="video" width="240" height:"150" autoplay></video>
  <div class="camera">
    <button id="snap"></button>
    <div class="cameraOne"></div>
    <div class="cameraTwo"></div>
    <div class="cameraThree">
      <div class="cameraSix"></div>
    </div>
    <div class="cameraFour"></div>
    <div class="cameraFive"><span class="cameraFiveOne">One</span><span class="cameraFivePlus">+</span><span class="cameraFiveStep">Step</span></div>
    
  </div>
  <div class="cameraBottom">
    <div class="cameraBottomOne"></div>
    <div class="cameraBottomTwo"></div>
    <div class="cameraBottomThree"> Polaroid</div>
    <canvas id="canvas" width="240" height:"150"></canvas>
  </div>

  </body>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@200&display=swap');

@import url('https://fonts.googleapis.com/css2?family=Architects+Daughter&display=swap');

body{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height:100vh;
  overflow: hidden;
  background-color:#D2F0D1;
}

#video {
  display: none;
}

.camera{
  width: 366px;
  height: 209px;
  background-color:#202022;
  border-radius: 15px 15px 0px 0px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  &One{
    margin-left: 17px;
    margin-top: 17px;
    width: 59px;
    height: 113px;
    background: linear-gradient(to bottom, #A9A9A9, #555557 30%, #555557 45%, #555557 60%, #555557 75%,#A9A9A9);
    border-radius: 5px;
    border: 2px solid black;
    box-sizing: border-box;
    box-shadow: 2px 1px 5px white;
    position: relative;
    opacity: 0.8;
    &::after{
      height: 100%;
      width: 70%;
      content:"";
      position: absolute;
      background: linear-gradient(to right, white 8%, grey 10%, white 20%, white 40%, black 41%, white, white, white 70%, grey 71%, white);
      border-left: 5px solid white;
      border-right: 5px solid white;
      box-sizing: border-box;
      left: 15%;
    }
    &::before{
      width: 20px;
      height: 20px;
      background-color: black;
      content:"+";
      color: white;
      position: absolute;
      right: -35px;
      font-size: 25px;
      font-weight: 500;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      filter: blur(1.5px);
    }
  }
  &Two{
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #343339;
    margin-left: 85px;
    margin-top: 57px;
    background: linear-gradient(to right, #357866,#101818,#101818 70%,#357866 80%);
    z-index: 99;
    box-shadow: -5px -5px 10px 35px rgba(0,0,0,0.41), 0px 0px 0px 5px #1F2928, 0px 0px 0px 6px black, 0px 0px 0px 10px #222224, 0px 0px 0px 11px black, 0px 0px 0px 40px #2B3134, 0px 0px 0px 41px black, 0px 0px 0px 50px #38383A, 0px -1px 2px 50.5px white, 0px 2px 2px 50.5px black, 0px 5px 5px 51px black;
    &::before{
      width: 13px;
      height: 13px;
      border-radius: 50%;
      content:"";
      background-color: red;
      position: absolute;
      left: 92px;
      box-sizing: border-box;
      top: 50px;
      background: linear-gradient(135deg, white, black 60%);
      border: 3px solid black;
      box-shadow: 0px 0px 2px 0.2px white;
    }
  }
  &Three{
    right: 14px;
    top: 14px;
    position: absolute;
    width: 70px;
    height: 73px;
    border-radius: 10px;
    background-color: black;
    box-shadow: 2px 1px 5px white;
    overflow: hidden;
    &::before{
      width: 54px;
      height: 63px;
      background-color: white;
      background: radial-gradient(circle, #696969 40%, white, #696969);
      content:"";
      position: absolute;
      border-radius: 10px;
      left: 3px;
      bottom: 3px;
    }
    &::after{
      content:"";
      position: absolute;
      width: 0;
     height: 0;
      left: 10px;
      top: -20px;
      transform: rotate(15deg);
     border-right: 50px solid transparent;
     border-top: 80px solid transparent;
     border-left: 50px solid #19191990;
     border-bottom: 50px solid #19191990;
    }
  }
  &Six{
    width: 60px;
    height: 20px;
    top: 8px;
    left: 0px;
    background-color: black;
    background: radial-gradient(circle, black 20%, transparent);
    position: absolute;
    z-index: 99;
    border-radius: 50%;
    filter: brightness(200%);
    &::after{
      content:"";
      position: absolute;
      width: 10px;
      height: 10px;
      border-radius: 20%;
      left: 25px;
      top: 30px;
      background: radial-gradient(circle, white 40%, transparent);
    }
    &::before{
      content:"";
      position: absolute;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      left: 5px;
      bottom: -40px;
      background: radial-gradient(circle, white 40%, transparent);
      filter: brightness(200%);
    }
  }
  &Four{
    height: 44px;
    width: 8px;
    position: absolute;
    left: 170px;
    bottom: 0px;
    background-color: red;
    box-shadow: 8px 0px 0px 0px orange, 16px 0px 0px 0px yellow, 24px 0px 0px 0px green, 32px 0px 0px 0px blue;
    &::before{
      width: 33px;
      height: 16px;
      border-radius: 30px;
      background-color: black;
      position: absolute;
      content:"";
      left: 130px;
      top: -65px;
      box-shadow: 0.2px 0.2px 1px white;
    }
    &::after{
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background-color: black;
      border-right: 1px solid white;
      border-left: 0.5px solid white;
      position: absolute;
      content:"";
      left: 138px;
      top: -64px;
    }
  }
  &Five{
    position: relative; 
    color: #6C6B71;
    left: 70px;
    display: flex;
    flex-direction: column;
    top: 160px;
    font-family: arial;
    font-size: 22px;
    width: 60px;
    height: 40px;
    &::before{
      width: 15px;
      height: 15px;
      border-radius: 50%;
      background-color: #0D0908;
      content:"";
      position: absolute;
      left: -30px;
      top: -15px;
      border: 1px solid #59585D;
      box-shadow: -1px 0px 0px 3px #28272C, 1px -1px 0px 2.5px #ffffff80, 0px 0px 0px 4px black;
    }
    &::after{
        content:"";
        position: absolute;
        height: 115px;
        background-color: #91929750;
        width: 10px;
        top: 48px;
        right: -22px;
        z-index:99;
      }
    &Plus{
      font-size: 30px;
      color:#84545A;
      position: absolute;
      right: 0px;
      top: 5px;
    }
    &One{
      position: absolute;
      right: 14px;
      top: 1px;
      &::before{
        content:"-";
        position: absolute;
        top: -66px;
        font-size: 20px;
        left: -13px;
        text-shadow: 2px 2px 3px black;
        font-family: 'Source Code Pro', monospace;
      }
       &::after{
        content:"+";
        position: absolute;
        top: -66px;
        font-size: 20px;
        left: 45px;
        text-shadow: 2px 2px 3px black;
        font-family: 'Source Code Pro', monospace;
      }
    }
    &Step{
      position: absolute;
      right: 16px;
      top: 16px;
    }
  }
  &Bottom {
    width: 392px;
  height: 124px;
    background-color:#1E1D23;
    box-sizing: border-box;
    border-bottom: 9px solid black;
    border-radius: 5px 5px 10% 10%;
    position: relative;
    box-shadow: -5px -2px 3px #ffffff40;
    &One{
      width: 103px;
      height: 20px;
      position: absolute;
      box-sizing: border-box;
      border-radius: 0px 0px 8px 8px;
      background: linear-gradient(to bottom, #343338 55%, #9D9EA3);
      box-shadow: 0px 1px 3px 1px #9D9EA3, 5px 1px 3px 3px #222126, 5px 2px 0px 3px #9D9EA3, -5px 1px 3px 3px #222126, -5px 2px 0px 3px #9D9EA3;
      top: 0px;
      left: 146px;
      &::before{
        position: absolute;
        content:"";
        width: 70px;
        height: 17px;
        background: linear-gradient(to right, #39383D, #05060A);
        border-radius: 15px;
        left: 18px;
        top: 3px;
        border: 2px solid black;
        box-sizing: border-box;
      }
      &::after{
        position: absolute;
        content:"";
        width: 17px;
        height: 17px;
        background: linear-gradient(to right, #39383D, #05060A);
        border-radius: 50%;
        left: 60px;
        top: 2px;
        border-right: 0.01px solid white;
        box-sizing: border-box;
        box-shadow: 0px 2px 1px black, -0.5px 2px 1px white;
      }
    }
    &Two{
      width: 313px;
      height: 26px;
      background-color: #040308;
      position: absolute;
      top: 45px;
      left:37px;
      box-sizing: border-box;
      border-left: 8px solid #323136;
      border-right: 8px solid #323136;
      box-shadow: 0px 1px 2px 1px #ffffff40;
      &::before{
        content:"";
        position: absolute;
        height: 5px;
        background-color: #323136;
        width: 290px;
        top: 6px;
        left: 4px;
      }
      &::after{
        content:"";
        position: absolute;
        height: 115px;
        background-color: #91929750;
        width: 10px;
        top: -45px;
        left: -40px;
        z-index:99;
      }
    }
    &Three{
      position: absolute;
      font-family: arial;
      font-size: 24px;
      font-weight: bold;
      color: #6C6B71;
      bottom: 0px;
      left: 150px;
      &::after{
        content:"I-type camera";
        position: absolute;
        bottom: 5px;
        right: -125px;
        text-transform: uppercase;
        color: #6D6C71;
        font-size: 10px;
        font-weight: 400;
        width: max-content;
      }
      &::before{
        content:"";
        position: absolute;
        top: -5px;
        left: -95px;
        width: 26px;
        height: 6px;
        background-color: #6D6C71;
        box-sizing: border-box;
        border-bottom: 3px solid #1E1D23;
        box-shadow:  0px 3px 0px 0px #6D6C71, 0px 6px 0px 0px #1E1D23, 0px 9px 0px 0px #6D6C71, 0px 12px 0px 0px #1E1D23, 0px 17px 0px 0px #6D6C71, 0px 20px 0px 0px #1E1D23, 0px 26px 0px 0px #6D6C71;
      }
    }
    &::after{
      position: absolute;
      content: "";
      width: 120px;
      height: 20px;
      background-color:#2C2B30;
      border-bottom-right-radius: 15px;
      border-top-left-radius: 5px;
      border-bottom: 2px solid black;
      border-right: 2px solid black;
    }
    &::before{
      position: absolute;
      content: "";
      width: 120px;
      height: 20px;
      right:0px;
      background-color:#2C2B30;
      border-top-right-radius: 5px;
      border-bottom-left-radius: 15px;
      border-bottom: 2px solid black;
      border-left: 2px solid black;
    }
  }
}

#snap{
 width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  position: absolute;
  background-color: #E31200;
  left: 15px;
  box-sizing: border-box;
  border-left: 1px solid white;
  border-right: 0.3px solid white;
  bottom: 6px;
  box-shadow:  0px 0px 0px 3px black, 0px -2px 2px 5px #53343C, 0px 0px 3px 9px black;
  &:active{
    border: none;
  }
}

@keyframes print{
  0%{
    height: 0px;
  }
  50%{
    height: 75px;
  }
  99%{
    height: 150px;
    border-top: none;
  }
  100%{
    height: 150px;
    border-top: 10px solid white;
  }
}

.print{
  opacity: 1;
  animation: print linear 3s forwards;
}

canvas{
  border: 10px solid white;
  border-top: none;
  position: absolute;
  box-shadow: 2px 2px 10px black;
  z-index:999;
  height: 0px;
  opacity: 0;
  top: 60px;
  width: 240px;
  left: 65px;
}

.title{
  font-family: arial;
  font-size: 24px;
  width: 40%;
  text-align: center;
  margin-bottom: 10px;
  font-family: 'Architects Daughter', cursive;
  color:#F7878F;
}

              
            
!

JS

              
                
var video = document.getElementById('video');


if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
    navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
        video.srcObject = stream;
        video.play();
    });
}


var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');

document.getElementById("snap").addEventListener("click", function() {
	context.drawImage(video, 0, 0, 240, 150);
  canvas.classList.add("print");
});




document.getElementById("canvas").addEventListener("click", function(){
  canvas.classList.remove("print");
})


              
            
!
999px

Console