forked from wesbos/hot-tips
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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%); | ||
} |