Skip to content

Commit

Permalink
feat: add flip to the client endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
zihaooo committed May 18, 2024
1 parent e8d57f2 commit 11d3b36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Add query parameters to the URL (`?parameter=value&otherparameter=value`):
- `color`: (true/false) Enable or disable color.
- `portrait`: (true/false) Enable or disable portrait mode.
- `rate`: (integer, 100-...) Set the frame rate.
- `flip`: (true/false) Enable or disable flipping 180 degree.
## Tunneling
Tunneling with built-in Ngrok allows for streaming across different networks.
Expand Down
6 changes: 6 additions & 0 deletions client/canvasHandling.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ function resizeVisibleCanvas() {
visibleCanvas.style.width = containerWidth + "px";
visibleCanvas.style.height = containerWidth / aspectRatio + "px";
}

if (flip) {
visibleCanvas.style.transform = "rotate(180deg)";
} else {
visibleCanvas.style.transform = "rotate(0deg)";
}
}
function waiting(message) {
// Clear the canvas
Expand Down
2 changes: 2 additions & 0 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const height = 1404;
const rawCanvas = new OffscreenCanvas(width, height); // Define width and height as needed
let portrait = getQueryParam('portrait');
portrait = portrait !== null ? portrait === 'true' : false;
let flip = getQueryParam('flip');
flip = flip !== null ? flip === 'true' : false;
let withColor = getQueryParam('color', 'true');
withColor = withColor !== null ? withColor === 'true' : true;
let rate = parseInt(getQueryParamOrDefault('rate', '200'), 10);
Expand Down

0 comments on commit 11d3b36

Please sign in to comment.