Spaces:
Runtime error
Runtime error
do not mirror if rearcam active
Browse files- public/sketch.js +7 -5
public/sketch.js
CHANGED
|
@@ -226,11 +226,13 @@ function draw() {
|
|
| 226 |
text('turn on your webcam', width/2, height/2);
|
| 227 |
|
| 228 |
if(capture != undefined){
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
|
|
|
|
|
|
| 234 |
image(capture, 0, 0)
|
| 235 |
}
|
| 236 |
}
|
|
|
|
| 226 |
text('turn on your webcam', width/2, height/2);
|
| 227 |
|
| 228 |
if(capture != undefined){
|
| 229 |
+
if(!active_rearcam){
|
| 230 |
+
//move image by the width of image to the left
|
| 231 |
+
translate(capture.width, 0);
|
| 232 |
+
//then scale it by -1 in the x-axis
|
| 233 |
+
//to flip the image
|
| 234 |
+
scale(-1, 1);
|
| 235 |
+
}
|
| 236 |
image(capture, 0, 0)
|
| 237 |
}
|
| 238 |
}
|