Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h1>🌷🌼🌸 Filter Me 🌸🌼🌷</h1>
<div class="buttons">
<button id="flower-crown">flower crown 💐</button>
<button id="bunny-ears">bunny ears 🐰</button>
<button id="dog-face">dog face 🐶</button>
</div>
<div class="webcam">
<video id="video" width="500" height="375" preload autoplay loop muted></video>
Expand Down
5 changes: 5 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const context = canvas.getContext('2d')
const tracker = new tracking.ObjectTracker('face')
const flowerCrownButton = document.getElementById('flower-crown')
const bunnyEarsButton = document.getElementById('bunny-ears')
const dogFaceButton = document.getElementById('dog-face')

const img = new Image()
let filterX = 0
Expand Down Expand Up @@ -30,6 +31,10 @@ bunnyEarsButton.addEventListener('click', () => {
changePic(-0.5, -0.9, 2, 2, 'bunny-ears.png')
})

dogFaceButton.addEventListener('click', () => {
changePic(-0.6, -0.6, 2, 2.5, 'dog-face.png')
});

tracker.setInitialScale(4)
tracker.setStepSize(2)
tracker.setEdgesDensity(0.1)
Expand Down