# p5.js

**URL:** https://discourse.processing.org/c/p5js/10.md?page=3

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 4

---

## [Repeatedly read a JSON file, refreshing sketch each time](https://discourse.processing.org/t/repeatedly-read-a-json-file-refreshing-sketch-each-time/47053)

<div class="topic-metadata">

**Author:** [@noahhsmith](https://discourse.processing.org/u/noahhsmith)\
**Replies:** 5\
**Last updated:** [August 31, 2025, 12:35pm UTC](https://discourse.processing.org/t/repeatedly-read-a-json-file-refreshing-sketch-each-time/47053 "2025-08-31T12:35:06Z")

</div>

Hi everyone, the ‘reading json example’ JSON is very close to what am needing. If could ‘loop’ this to repeatedly read json and refresh sketch, should have everything needed. Are there examples of such a ‘looping’ skelet…

---

## [Proposal to add a dayOfWeek() function to P5js](https://discourse.processing.org/t/proposal-to-add-a-dayofweek-function-to-p5js/47017)

<div class="topic-metadata">

**Author:** [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)\
**Replies:** 1\
**Last updated:** [August 25, 2025, 1:19pm UTC](https://discourse.processing.org/t/proposal-to-add-a-dayofweek-function-to-p5js/47017 "2025-08-25T13:19:11Z")

</div>

const dayOfWeekDigit = new Date().getDay(); function dayOfWeek() { // : int, : 0 to 6, 0 is Sunday return dayOfWeekDigit; }

---

## [Performance differences with POINTS between 1.11 and 2.0](https://discourse.processing.org/t/performance-differences-with-points-between-1-11-and-2-0/46959)

<div class="topic-metadata">

**Author:** [@hx2A](https://discourse.processing.org/u/hx2A)\
**Replies:** 9\
**Last updated:** [August 25, 2025, 6:02am UTC](https://discourse.processing.org/t/performance-differences-with-points-between-1-11-and-2-0/46959 "2025-08-25T06:02:06Z")

</div>

I have some questions about performance differences for POINTS shapes and related POINTS questions. Compared to 1.11, the below code is much slower in p5.js 2.0. The goal is to draw 50K points with WEBGL. (I am drawing …

---

## [My regular expression is not working](https://discourse.processing.org/t/my-regular-expression-is-not-working/47004)

<div class="topic-metadata">

**Author:** [@quark](https://discourse.processing.org/u/quark)\
**Replies:** 2\
**Last updated:** [August 21, 2025, 10:07pm UTC](https://discourse.processing.org/t/my-regular-expression-is-not-working/47004 "2025-08-21T22:07:13Z")

</div>

I am trying to parse this string to find attribute assignments \<body width="500" linegap="2" paragap="8" align="justify" font="courier new"\>' An attribute assignment is of the format name="value" where the format is …

---

## [Petition : Oracle, it’s time to free JavaScript](https://discourse.processing.org/t/petition-oracle-it-s-time-to-free-javascript/46954)

<div class="topic-metadata">

**Author:** [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)\
**Replies:** 0\
**Last updated:** [August 17, 2025, 12:24pm UTC](https://discourse.processing.org/t/petition-oracle-it-s-time-to-free-javascript/46954 "2025-08-17T12:24:29Z")

</div>

The link that explains everything

---

## [Error : "n is not a function"](https://discourse.processing.org/t/error-n-is-not-a-function/46936)

<div class="topic-metadata">

**Author:** [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)\
**Replies:** 5\
**Last updated:** [August 16, 2025, 11:59am UTC](https://discourse.processing.org/t/error-n-is-not-a-function/46936 "2025-08-16T11:59:01Z")

</div>

Hello, I’ve translated in P5js with Gemini IA a big sketch written in Java to test if it was possible. It almost works with some modifications. But I still have an error : “Uncaught type error : n is not a function (p…

---

## [Let or nothing?](https://discourse.processing.org/t/let-or-nothing/46937)

<div class="topic-metadata">

**Author:** [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)\
**Replies:** 4\
**Last updated:** [August 16, 2025, 10:20am UTC](https://discourse.processing.org/t/let-or-nothing/46937 "2025-08-16T10:20:32Z")

</div>

Hello, If I create a new variable, I ‘m going to write let thing = 5; for example. But if I write thing = 5; (while I haven’t already created a variable ‘thing’) that works too! is there a difference? …

---

## [List of system variables](https://discourse.processing.org/t/list-of-system-variables/46924)

<div class="topic-metadata">

**Author:** [@jdiodato](https://discourse.processing.org/u/jdiodato)\
**Replies:** 1\
**Last updated:** [August 14, 2025, 6:20am UTC](https://discourse.processing.org/t/list-of-system-variables/46924 "2025-08-14T06:20:39Z")

</div>

Does anyone know if there’s a list of system variables somewhere in the p5 docs? I found this page in the docs that goes over mouseX and mouseY, but the AI overview from a quick Google search also pulls up a ton of other…

---

## [Table is not defined (p5.Table)](https://discourse.processing.org/t/table-is-not-defined-p5-table/46735)

<div class="topic-metadata">

**Author:** [@pemb](https://discourse.processing.org/u/pemb)\
**Replies:** 7\
**Last updated:** [July 16, 2025, 3:51pm UTC](https://discourse.processing.org/t/table-is-not-defined-p5-table/46735 "2025-07-16T15:51:15Z")

</div>

Hi all, I am having some trouble to make a new row in a csv file. While in the setup() function it seems I can access to the cvs data, it seems that in the draw() function and the callback function of a button I get “tab…

---

## [canvasGUI 1.1.0 released](https://discourse.processing.org/t/canvasgui-1-1-0-released/46720)

<div class="topic-metadata">

**Author:** [@quark](https://discourse.processing.org/u/quark)\
**Replies:** 0\
**Last updated:** [July 13, 2025, 10:40am UTC](https://discourse.processing.org/t/canvasgui-1-1-0-released/46720 "2025-07-13T10:40:54Z")

</div>

For those who don’t know canvasGUI it is a p5.js library used to create on-canvas GUIs. It works seamlessly on P2D and WEBGL canvases and the controls respond to both mouse and touch events. This makes it ideal for shari…

---

## [Why doesn't p5.js support .otf colorfonts?](https://discourse.processing.org/t/why-doesnt-p5-js-support-otf-colorfonts/46623)

<div class="topic-metadata">

**Author:** [@rbytes](https://discourse.processing.org/u/rbytes)\
**Replies:** 14\
**Last updated:** [July 6, 2025, 8:54am UTC](https://discourse.processing.org/t/why-doesnt-p5-js-support-otf-colorfonts/46623 "2025-07-06T08:54:36Z")

</div>

I discovered .otf colorfonts about 8 years ago, and am pleased to say that almost all browsers now support them. Yet p5.js is not configured to recognize them, nor is JavaScript, as far as i can discover. This should be…

---

## [Switching Versions on p5.js Editor](https://discourse.processing.org/t/switching-versions-on-p5-js-editor/46656)

<div class="topic-metadata">

**Author:** [@Tipo](https://discourse.processing.org/u/Tipo)\
**Replies:** 0\
**Last updated:** [July 3, 2025, 1:42pm UTC](https://discourse.processing.org/t/switching-versions-on-p5-js-editor/46656 "2025-07-03T13:42:43Z")

</div>

How to switch to the latest release of p5.js 2.0!

---

## [Error when using preload() with Vite + TypeScript: “Cannot read properties of undefined (reading 'pixels')”](https://discourse.processing.org/t/error-when-using-preload-with-vite-typescript-cannot-read-properties-of-undefined-reading-pixels/46431)

<div class="topic-metadata">

**Author:** [@tomokikun](https://discourse.processing.org/u/tomokikun)\
**Replies:** 3\
**Last updated:** [June 30, 2025, 9:08am UTC](https://discourse.processing.org/t/error-when-using-preload-with-vite-typescript-cannot-read-properties-of-undefined-reading-pixels/46431 "2025-06-30T09:08:19Z")

</div>

TL;DR: I’m using p5.js with TypeScript + Vite. When I try to use preload(), I get runtime errors like: Uncaught FESError: Stopping sketch to prevent more errors Uncaught TypeError: Cannot read properties of undefined (…

---

## [Can you help me to understand the code of this sketch?](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455)

<div class="topic-metadata">

**Author:** [@amaury](https://discourse.processing.org/u/amaury)\
**Replies:** 4\
**Last updated:** [June 27, 2025, 1:45pm UTC](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455 "2025-06-27T13:45:34Z")

</div>

Hi, Is there a way to predict where the square and rectangle will appear in the sketch below ? Is it linked to the nature of the “noise” function ? https://openprocessing.org/sketch/2026851 Thanks for your help.

---

## [P5.js movement logic — detective stops unexpectedly at corners in maze game](https://discourse.processing.org/t/p5-js-movement-logic-detective-stops-unexpectedly-at-corners-in-maze-game/46605)

<div class="topic-metadata">

**Author:** [@Andrew-James](https://discourse.processing.org/u/Andrew-James)\
**Replies:** 2\
**Last updated:** [June 25, 2025, 1:17pm UTC](https://discourse.processing.org/t/p5-js-movement-logic-detective-stops-unexpectedly-at-corners-in-maze-game/46605 "2025-06-25T13:17:45Z")

</div>

Hi everyone, I’m working on a p5.js project where a detective character follows a fixed path through a “Vice City”-style maze to catch a criminal named Fox. The movement is controlled by conditional statements that upda…

---

## [Browser Freeze + Massive Load Time. (When trying to compile shaders.)](https://discourse.processing.org/t/browser-freeze-massive-load-time-when-trying-to-compile-shaders/46509)

<div class="topic-metadata">

**Author:** [@winterchan](https://discourse.processing.org/u/winterchan)\
**Replies:** 7\
**Last updated:** [June 6, 2025, 3:12am UTC](https://discourse.processing.org/t/browser-freeze-massive-load-time-when-trying-to-compile-shaders/46509 "2025-06-06T03:12:00Z")

</div>

this is the code: https://openprocessing.org/sketch/2663057 The application is experiencing long freezes when switching fractal types for the first time in a session. The problem is spited into 2 questions: -Main P…

---

## [P5 point cloud with textures](https://discourse.processing.org/t/p5-point-cloud-with-textures/46393)

<div class="topic-metadata">

**Author:** [@hallohallo1234](https://discourse.processing.org/u/hallohallo1234)\
**Replies:** 12\
**Last updated:** [June 5, 2025, 10:37pm UTC](https://discourse.processing.org/t/p5-point-cloud-with-textures/46393 "2025-06-05T22:37:30Z")

</div>

is there a way to map a texture of a obj on points that i create in p5 with beginShape(POINTS). i would like that the user is able to load a texture alongside a .obj and it will map the colors of the texture accurately o…

---

## [Error when activating p5.js mode in Desktop](https://discourse.processing.org/t/error-when-activating-p5-js-mode-in-desktop/46336)

<div class="topic-metadata">

**Author:** [@edwin\_isensee](https://discourse.processing.org/u/edwin_isensee)\
**Replies:** 2\
**Last updated:** [May 6, 2025, 10:03pm UTC](https://discourse.processing.org/t/error-when-activating-p5-js-mode-in-desktop/46336 "2025-05-06T22:03:14Z")

</div>

I just installed Processing 4.4.1 on my Windows 11 laptop. After that, I installed the p5.js mode. Everything went fine. However, when I try to activate the p5.js mode, I receive a weird message saying “A nasty error occ…

---

## [Problem using p5 'esm' via jsdeliver (cdn)](https://discourse.processing.org/t/problem-using-p5-esm-via-jsdeliver-cdn/46279)

<div class="topic-metadata">

**Author:** [@dalanicolai](https://discourse.processing.org/u/dalanicolai)\
**Replies:** 3\
**Last updated:** [April 26, 2025, 8:34am UTC](https://discourse.processing.org/t/problem-using-p5-esm-via-jsdeliver-cdn/46279 "2025-04-26T08:34:20Z")

</div>

Hello, I am very new to javascript and even more to ES modules. However, I think I am trying things out correctly here. But as I am not sure if I am doing things right, I first drop a question here before I report an is…

---

## [Can't switch to p5.js mode](https://discourse.processing.org/t/cant-switch-to-p5-js-mode/46252)

<div class="topic-metadata">

**Author:** [@jaeho](https://discourse.processing.org/u/jaeho)\
**Replies:** 2\
**Last updated:** [April 20, 2025, 2:09pm UTC](https://discourse.processing.org/t/cant-switch-to-p5-js-mode/46252 "2025-04-20T14:09:30Z")

</div>

After updating to Processing 4.4.1, I can’t switch to p5.js mode. An error window appears that says : The p5.js is already the latest version. Removing and reinstalling it does not help. Any idea? Thanks in advan…

---

## [Share function in menu](https://discourse.processing.org/t/share-function-in-menu/46249)

<div class="topic-metadata">

**Author:** [@Frankyates](https://discourse.processing.org/u/Frankyates)\
**Replies:** 3\
**Last updated:** [April 20, 2025, 1:02pm UTC](https://discourse.processing.org/t/share-function-in-menu/46249 "2025-04-20T13:02:23Z")

</div>

Hi The menu SHARE has disappeared From menu (it is a saved script) Can you help? Is this happening only in France?

---

## [canvasGUI v1.0.0](https://discourse.processing.org/t/canvasgui-v1-0-0/46236)

<div class="topic-metadata">

**Author:** [@quark](https://discourse.processing.org/u/quark)\
**Replies:** 0\
**Last updated:** [April 17, 2025, 5:47pm UTC](https://discourse.processing.org/t/canvasgui-v1-0-0/46236 "2025-04-17T17:47:13Z")

</div>

Thanks to @rbytes for prodding me to include touch events and to @GoToLoop for introducing me to the joy of CDN (Content Delivery Network) both of these features have been included in v1.0.0 In particular the CDN means …

---

## [Seeking Your Input: What Tutorials & Documentation Does p5.js Need Next?](https://discourse.processing.org/t/seeking-your-input-what-tutorials-documentation-does-p5-js-need-next/46232)

<div class="topic-metadata">

**Author:** [@Mamatha1718](https://discourse.processing.org/u/Mamatha1718)\
**Replies:** 0\
**Last updated:** [April 17, 2025, 5:20am UTC](https://discourse.processing.org/t/seeking-your-input-what-tutorials-documentation-does-p5-js-need-next/46232 "2025-04-17T05:20:19Z")

</div>

Hello everyone! :waving\_hand: As suggested by Kit, I’m opening this Discourse thread to gather your valuable feedback and ideas. I’m currently working on creating beginner-friendly tutorials and community resources for …

---

## [Text Not Centered in Canvas - Help Needed with p5.js](https://discourse.processing.org/t/text-not-centered-in-canvas-help-needed-with-p5-js/46207)

<div class="topic-metadata">

**Author:** [@moracapaoladesign](https://discourse.processing.org/u/moracapaoladesign)\
**Replies:** 1\
**Last updated:** [April 13, 2025, 9:14am UTC](https://discourse.processing.org/t/text-not-centered-in-canvas-help-needed-with-p5-js/46207 "2025-04-13T09:14:37Z")

</div>

Hello everyone, I’m currently working on a p5.js project, and I’m having an issue with centering text on the canvas. Despite setting the text alignment to CENTER both horizontally and vertically, the text keeps appearin…

---

## [CanvasGUI problems](https://discourse.processing.org/t/canvasgui-problems/46089)

<div class="topic-metadata">

**Author:** [@rbytes](https://discourse.processing.org/u/rbytes)\
**Replies:** 28\
**Last updated:** [April 9, 2025, 9:51am UTC](https://discourse.processing.org/t/canvasgui-problems/46089 "2025-04-09T09:51:07Z")

</div>

The sliders do not work with touch in p5js. I am using Safari on an iPad Pro. I have no problem using sliders in other guis, and the built in p5js sliders work fine as well.

---

## [P5.js sound map sketch not working on safari, working perfectly on chrome!](https://discourse.processing.org/t/p5-js-sound-map-sketch-not-working-on-safari-working-perfectly-on-chrome/46178)

<div class="topic-metadata">

**Author:** [@calfish](https://discourse.processing.org/u/calfish)\
**Replies:** 1\
**Last updated:** [April 8, 2025, 7:01pm UTC](https://discourse.processing.org/t/p5-js-sound-map-sketch-not-working-on-safari-working-perfectly-on-chrome/46178 "2025-04-08T19:01:11Z")

</div>

Hi, I am hosting a p5 sketch at https://calfish.land/radiomap.html It’s working fine on chrome, i can’t find any missing assets and everything is locally hosted. On safari the sketch won’t load and the console shows a …

---

## [P5js editor unindenting code with TAB + SHIFT not working anymore](https://discourse.processing.org/t/p5js-editor-unindenting-code-with-tab-shift-not-working-anymore/46171)

<div class="topic-metadata">

**Author:** [@Laurent](https://discourse.processing.org/u/Laurent)\
**Replies:** 2\
**Last updated:** [April 7, 2025, 4:06pm UTC](https://discourse.processing.org/t/p5js-editor-unindenting-code-with-tab-shift-not-working-anymore/46171 "2025-04-07T16:06:08Z")

</div>

Hi everybody, Common and universal shortcut keys TAB + SHIFT to unindent code is no more working in editor.p5js.org editor. TAB shortcut for indentation is still working. Any ideas? Does an update cause this issue? Or c…

---

## [canvasGUI new version (0.9.5)](https://discourse.processing.org/t/canvasgui-new-version-0-9-5/46116)

<div class="topic-metadata">

**Author:** [@quark](https://discourse.processing.org/u/quark)\
**Replies:** 2\
**Last updated:** [March 30, 2025, 7:48pm UTC](https://discourse.processing.org/t/canvasgui-new-version-0-9-5/46116 "2025-03-30T19:48:28Z")

</div>

USE VERSION 0.9.6 canvasGUI (0.9.5) now supports touch screen events so Slider and Ranger controls can be now used on mobile devices. You can try it out here. canvasGUI - website and github

---

## [P5js web editor - Web workers do not work](https://discourse.processing.org/t/p5js-web-editor-web-workers-do-not-work/46043)

<div class="topic-metadata">

**Author:** [@quark](https://discourse.processing.org/u/quark)\
**Replies:** 1\
**Last updated:** [March 23, 2025, 11:46am UTC](https://discourse.processing.org/t/p5js-web-editor-web-workers-do-not-work/46043 "2025-03-23T11:46:01Z")

</div>

I have been messing about with p5.geometry and created a 3D Mandelbrot viewer. This is a sample screenshot. The sketch uses a web worker to calculate the Mandelbrot set but when I upload it to the p5js web editor the…

---

## [TypeError: Cannot read properties of undefined (reading '-5')](https://discourse.processing.org/t/typeerror-cannot-read-properties-of-undefined-reading-5/44916)

<div class="topic-metadata">

**Author:** [@JakobVirgil](https://discourse.processing.org/u/JakobVirgil)\
**Replies:** 13\
**Last updated:** [August 10, 2024, 3:57pm UTC](https://discourse.processing.org/t/typeerror-cannot-read-properties-of-undefined-reading-5/44916 "2024-08-10T15:57:32Z")

</div>

It gives line numbers like “at undefined:53042:53” The number ranges from 0 to -5 depending on the length of my code. here is the code

[Previous page](https://discourse.processing.org/c/p5js/10.md?page=2)

[Next page](https://discourse.processing.org/c/p5js/10.md?page=4)
