# Getting gif exporting via ccapture working in the p5js web editor

**URL:** https://discourse.processing.org/t/getting-gif-exporting-via-ccapture-working-in-the-p5js-web-editor/7815
**Category:** Libraries
**Created:** [January 24, 2019, 4:49pm UTC](https://discourse.processing.org/t/getting-gif-exporting-via-ccapture-working-in-the-p5js-web-editor/7815 "2019-01-24T16:49:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jgl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jgl/32/3401_2.png) [@jgl](https://discourse.processing.org/u/jgl)
#### Post date: [January 24, 2019, 4:49pm UTC](https://discourse.processing.org/t/getting-gif-exporting-via-ccapture-working-in-the-p5js-web-editor/7815/1 "2019-01-24T16:49:13Z")

</div>

Hi All,

I’m trying to get animated gif export via ccapture.js, there is an example here:

> [@How to save your p5.js sketch as a GIF using CCapture.js](https://discourse.processing.org/t/how-to-save-your-p5-js-sketch-as-a-gif-using-ccapture-js/1264/2):
>
> I’ve managed to host a CCapture demo sketch online: star_struck[https://ThimbleProjects.org/gotoloop/509340](https://ThimbleProjects.org/gotoloop/509340)[https://ThimbleProjects.org/gotoloop/509340/sketch.js](https://ThimbleProjects.org/gotoloop/509340/sketch.js) Important note: the CCapture library demands the file “gif.worker.js” in order to save all of the capture() canvas frames as a “.gif” file! You can grab 1 at the link below: robot[http://cdn.JsDelivr.net/npm/gif.js/dist/gif.worker.js](http://cdn.JsDelivr.net/npm/gif.js/dist/gif.worker.js) “index.html”: \<!DOCTYPE html\> \<meta charset=utf-8\> \<meta name=viewport content=width=device-wi…

I’ve duplicated @GoToLoop code into the online editor:

> **[p5.js Web Editor](https://editor.p5js.org/jgl/sketches/HXrHh8ITH)**
>
> A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners.

But I get the error:

“ReferenceError: can’t access lexical declaration `bg’ before initialization (: line 45)”

Does anyone have a working version of CCapture exporting a gif on the p5.js web editor?

Cheers,

Joel

---

<div class="post-metadata">

### Author: ![peteyhayman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/peteyhayman/32/4628_2.png) [@peteyhayman](https://discourse.processing.org/u/peteyhayman)
#### Post date: [April 16, 2019, 6:59am UTC](https://discourse.processing.org/t/getting-gif-exporting-via-ccapture-working-in-the-p5js-web-editor/7815/2 "2019-04-16T06:59:12Z")

</div>

hi @jgl

Havn’t worked with CCapture but I am working on an animation loop library which supports GIF exports:

> **[p5.createloop](https://www.npmjs.com/package/p5.createloop)**
>
> p5.createLoop provides a simple and structured p5 library for creating animation loops in the browser.
