Closed max-kibosh closed 1 year ago
You can call props.exportFrame()
where props
is the main parameter to your sketch.
Thanks! In regards to the props, I'm using the standard way described in the docs:
const sketch = () => {
return ({ context, width, height, frame }) => {
// ...
}
};
and calling Tweakpane and canvasSketch at the end:
createPane();
canvasSketch(sketch, settings);
exportFrame() would be a function of what here? Sorry for the inconvenience.
Figured it out, I was a bit confused but figured out the context. Thanks for the help!
For future reference for anybody stumbling upon this issue, it looks like this:
const sketch = (props) => {
myButton.onclick = () => props.exportFrame();
return () => { /* render fn */ };
}
Cheers :smile:
I want to export the canvas (usually done with ctrl + s) through code. I'm using Tweakpane and would like to export upon a button being pressed but I can't find a relevant method in the docs.
Would appreciate any guidance :)