Skip to content

Instantly share code, notes, and snippets.

@manthrax
Created November 13, 2021 13:48
Show Gist options
  • Save manthrax/ac96ac0a41ddd012204d0181bbbded81 to your computer and use it in GitHub Desktop.
Save manthrax/ac96ac0a41ddd012204d0181bbbded81 to your computer and use it in GitHub Desktop.
Take a screenshot of canvas and download as jpg
let takeScreenShot=()=>{
let d=document;
let e = d.createElement("a");
e.setAttribute("href", renderer.domElement.toDataURL("image/jpeg"));
e.setAttribute("download", "Screenshot.jpeg");
e.style.display = "none";
d.body.appendChild(e);
d.click();
d.body.removeChild(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment