You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script src="CCapture.all.min.js"></script>
<script>
var capturer = new CCapture( {
format: 'gif',
workersPath: 'js/gif.worker.js',
} );
var width = 300;
var height = 500;
function setup () {
p5canvas = createCanvas(width,height);
}
function draw () {
// code
if (frameCount === 0) capturer.start();
if (frameCount <= 100) {
capturer.capture(p5canvas);
console.log(frameCount);
} else {
capturer.stop();
capturer.save();
}
}
Error: Width and height must be set prior to rendering CCapture.all.min.js:1:16873
render file:///C:/Users/admin/Documents/Cubase Projects/Untitled-31/Video/CCapture.all.min.js:1
save file:///C:/Users/admin/Documents/Cubase Projects/Untitled-31/Video/CCapture.all.min.js:2
v file:///C:/Users/admin/Documents/Cubase Projects/Untitled-31/Video/CCapture.all.min.js:1
draw file:///C:/Users/admin/Documents/Cubase Projects/Untitled-31/Video/index.html:66
redraw file:///C:/Users/admin/Documents/Cubase Projects/Untitled-31/Video/p5.min.js:3
_draw file:///C:/Users/admin/Documents/Cubase Projects/Untitled-31/Video/p5.min.js:3
The text was updated successfully, but these errors were encountered:
I couldn't make the right debuggin, but I can confirm everything works fine. With p5.js v1
In my sketch there are many mistakes, wrong canvas DOM element for capturer, wrong if-esle condition, etc etc. I double-checked everything and finally made it work.
You probably need to add render function to the code and call it in the setup function, for example:
function render(){
requestAnimationFrame(render);
// rendering stuff ...
capturer.capture( p5canvas );
}
function setup(){
render()
...
}
I get this error with p5.js.
The text was updated successfully, but these errors were encountered: