# Using P5 on OffscreenCanvas?

**URL:** <https://discourse.processing.org/t/using-p5-on-offscreencanvas/40848>\
**Category:** Coding Questions\
**Created:** [February 6, 2023, 5:48pm UTC](https://discourse.processing.org/t/using-p5-on-offscreencanvas/40848 "2023-02-06T17:48:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnC](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@JohnC](https://discourse.processing.org/u/JohnC)\
**Post date:** [February 6, 2023, 5:48pm UTC](https://discourse.processing.org/t/using-p5-on-offscreencanvas/40848/1 "2023-02-06T17:48:36Z")

</div>

Is there a way to manipulate [OffscreenCanvas](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) with p5? As far as I understand the source code, `createGraphics` does not use it.

---

<div class="post-metadata">

**Author:** ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)\
**Post date:** [February 6, 2023, 9:54pm UTC](https://discourse.processing.org/t/using-p5-on-offscreencanvas/40848/2 "2023-02-06T21:54:44Z")

</div>

Short answer: not yet 🙂

OffscreenCanvas is still not entirely supported by all browsers but it has been announced that [this should be resolved this year](https://web.dev/interop-2023/).

We’ve discussed this [on the p5.js Discord](https://discord.com/channels/836700474425475088/1007853564363817060/1071139302978900088) before and here is what @davepagurek had to say about OffscreenCanvas:

> [@DavePagurek](#):
>
> Probably not speeding up rendering, but good for UX! it would let you run long-running render tasks without blocking the UI, so users can continue to interact with a sketch while the render is happening in the background.

If you’re specifically interested in offscreen buffer performance, you might want to check out Dave’s [p5.framebuffer](https://github.com/davepagurek/p5.Framebuffer) library.

I hope this helps. Let me know if you have any other questions.

---

<div class="post-metadata">

**Author:** ![JohnC](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@JohnC](https://discourse.processing.org/u/JohnC)\
**Post date:** [February 10, 2023, 4:23pm UTC](https://discourse.processing.org/t/using-p5-on-offscreencanvas/40848/3 "2023-02-10T16:23:45Z")

</div>

As @sableraph 's answer points out, p5 doesn’t support OffscreenCanvas yet.

> [@Using P5 on OffscreenCanvas?](https://discourse.processing.org/t/using-p5-on-offscreencanvas/40848/2):
>
> Short answer: not yet slight_smile OffscreenCanvas is still not entirely supported by all browsers but it has been announced that [this should be resolved this year](https://web.dev/interop-2023/). We’ve discussed this [on the p5.js Discord](https://discord.com/channels/836700474425475088/1007853564363817060/1071139302978900088) before and here is what @davepagurek had to say about OffscreenCanvas: If you’re specifically interested in offscreen buffer performance, you might want to check out Dave’s [p5.framebuffer](https://github.com/davepagurek/p5.Framebuffer) library. I hope this helps. Let me know if you have any other questions.

However, I wrote a small wrapper to do the trick: [GitHub - Real-John-Cheung/p5.OffscreenCanvas: A library for manipulating OffscreenCanvas with p5](https://github.com/Real-John-Cheung/p5.OffscreenCanvas) . Hope it helps if you need something like this
