Hello,
I have a file directory error which I cannot seem to resolve, any help much appreciated.
Its the “js/gif.worker.js”
html
<!DOCTYPE html><html lang="en"><head>
<script src="p5.js"></script>
<script src="p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8">
</head>
<body>
<script src="sketch.js"></script>
<script src="CCapture.all.min.js"></script>
<script src="js/gif.worker.js"></script>
<script>
var capturer = new CCapture( {
framerate: 60,
format: 'gif',
workersPath:'./js/',
verbose: true
} );
</script>
Here is the sketch
let gifLength = 180;
let canvas;
let x = 0;
function setup() {
p5Canvas = createCanvas(600, 600);
canvas = p5Canvas.canvas;
capturer.start();
ellipseMode(CENTER);
imageMode(CENTER);
}
function draw() {
background(240);
ellipse(x, 100, 50, 50);
x = x += 3;
if (x == width) {
x = 0;
}
if (frameCount < gifLength) {
capturer.capture(canvas);
} else if (frameCount === gifLength) {
capturer.stop();
capturer.save();
}
}