Skip to content

Commit

Permalink
face bigger
Browse files Browse the repository at this point in the history
  • Loading branch information
wesbos committed May 15, 2023
1 parent c6141c7 commit a30e5f5
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
32 changes: 32 additions & 0 deletions face-bigger/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FaceBigger</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<video src=""></video>
<script>
const video = document.querySelector(`video`);
// Get the webcam video and display it in the video element
navigator.mediaDevices
.getUserMedia({ video: true })
.then((stream) => {
video.srcObject = stream;
video.onloadedmetadata = (e) => {
video.play();
};
})
.catch((err) => {
console.log(err);
});
let scale = 0.25;
video.addEventListener(`click`, () => {
document.body.style.setProperty(`--scale`, (scale += 0.1));
});
</script>
</body>
</html>
26 changes: 26 additions & 0 deletions face-bigger/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* CSS reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
margin: 0;
padding: 0;
--scale: 0.25;
}
body {
margin: 0;
padding: 0;
overflow: hidden;
}

video {
width: 100%;
height: 100vh;
object-fit: cover;
scale: var(--scale);
transition: scale 0.5s ease-in-out;
transform: translateY(-30%);
filter: invert(500%) hue-rotate(80deg) saturate(300%);
}

0 comments on commit a30e5f5

Please sign in to comment.