Spaces:
Runtime error
Runtime error
Update public/sketch.js
Browse files- public/sketch.js +10 -7
public/sketch.js
CHANGED
|
@@ -239,14 +239,17 @@ function draw() {
|
|
| 239 |
|
| 240 |
if(capture != undefined){
|
| 241 |
if(!active_rearcam){
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
}
|
| 248 |
-
|
| 249 |
-
image(capture, 0, 0)
|
| 250 |
|
| 251 |
}
|
| 252 |
}
|
|
|
|
| 239 |
|
| 240 |
if(capture != undefined){
|
| 241 |
if(!active_rearcam){
|
| 242 |
+
push()
|
| 243 |
+
//move image by the width of image to the left
|
| 244 |
+
translate(capture.width, 0);
|
| 245 |
+
//then scale it by -1 in the x-axis
|
| 246 |
+
//to flip the image
|
| 247 |
+
scale(-1, 1);
|
| 248 |
+
image(capture,0, 0)
|
| 249 |
+
pop()
|
| 250 |
+
} else {
|
| 251 |
+
image(capture,0, 0)
|
| 252 |
}
|
|
|
|
|
|
|
| 253 |
|
| 254 |
}
|
| 255 |
}
|