p5-node icon indicating copy to clipboard operation
p5-node copied to clipboard

Is it possible create a stream from canvas?

Open matiasjs opened this issue 5 years ago • 1 comments

I want generate a stream from canvas on the backend and generate a video with 30fps or more.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream https://www.npmjs.com/package/canvas#canvascreatepngstream

matiasjs avatar May 13 '20 20:05 matiasjs

You can assign the created canvas to a var tp ref later const canvasElement = p.createCanvas(400, 400);

You could also use loadPixels() to get an array of the canvas data.

p.loadPixels();
return p.pixels;

owenmcateer avatar Sep 01 '21 15:09 owenmcateer