OAVp5.record.shot()#
functionoav-p5OAVp5.record.shot([o])
Saves the canvas alone as a PNG picture (not the 🎹, not the cards) and downloads it.
It is the button 📷 in the 🎹 panel as a function. The file is named oav-20261015-183005.png (with name in the middle when you give one) and is downloaded at once; on a phone that can share files a Share button appears on a card instead. The picture has the size of the canvas in pixels, so a retina screen gives twice the width and height. p5's own saveCanvas('name', 'png') does the same thing without the card.
Parameters
| Name | Type | Description |
|---|---|---|
o | Object | Options: canvas (the canvas to save: a <canvas>, a p5 canvas or a createGraphics() buffer; the biggest p5 canvas on the page by default) and name (a word for the file name). optional |
Returns
Promise<Object | null> Resolves to { name, blob, url, width, height, bytes }, or to null when there is no canvas or it cannot be read (an image from another site on it, no CORS).
Notes
- With the loading option
record=offthe 📷 button is gone andstartRecording()does nothing, but this function still saves the PNG (tried).
Examples
function setup() {
createCanvas(400, 300);
}
function keyPressed() {
if (key === 'p') OAVp5.record.shot({ name: 'still' });
}
function draw() {
background(20);
circle(mouseX, mouseY, 60);
fill(255);
text('press p to save a PNG of the canvas', 20, 30);
}Related
startRecording()Records the canvas and the sound your sketch makes into one video file, and returns a promise that says whether the recording began.OAVp5.recordThe object behind the recording names: the state, the time, the last file, the formats this browser can write and the screenshot function.recordingSaved()An event you define: it is called when a recording has been saved and checked, with aninfoobject about the file.