# p5.js

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

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

**Page:** 21

---

## [Adjust the text height of a radio button](https://discourse.processing.org/t/adjust-the-text-height-of-a-radio-button/38682)

<div class="topic-metadata">

**Author:** [@Sunt](https://discourse.processing.org/u/Sunt)\
**Replies:** 2\
**Last updated:** [September 8, 2022, 2:36pm UTC](https://discourse.processing.org/t/adjust-the-text-height-of-a-radio-button/38682 "2022-09-08T14:36:43Z")

</div>

Hi. I’m trying to align the text of a radio button. Without setting a specific font size, it is acceptable; but with smaller fonts, the text position will be lower. Is there a solution for that? function setup() { cr…

---

## [My "ai" keeps going to the bottom right](https://discourse.processing.org/t/my-ai-keeps-going-to-the-bottom-right/38672)

<div class="topic-metadata">

**Author:** [@Voleia](https://discourse.processing.org/u/Voleia)\
**Replies:** 3\
**Last updated:** [September 8, 2022, 10:04am UTC](https://discourse.processing.org/t/my-ai-keeps-going-to-the-bottom-right/38672 "2022-09-08T10:04:07Z")

</div>

So last year I had a course in p5.js and I’m still experimenting with it this year, thought I’m a complete noob. I’ve made this little simulation which is meant to be part of a bigger project I’m working on in my free ti…

---

## [Pixels array p5.js vs java improving speed](https://discourse.processing.org/t/pixels-array-p5-js-vs-java-improving-speed/38623)

<div class="topic-metadata">

**Author:** [@Sunt](https://discourse.processing.org/u/Sunt)\
**Replies:** 14\
**Last updated:** [September 7, 2022, 1:17pm UTC](https://discourse.processing.org/t/pixels-array-p5-js-vs-java-improving-speed/38623 "2022-09-07T13:17:36Z")

</div>

Hi. I translated a java to a p5.js sketch. The p5.js pixels array takes 4 times more values and I believe that is why it the sketch runs far more slowly. The java sketch runs faster as the gif image below. The p5.js run…

---

## [P5 LICENSE and p5.library LICENSE questions](https://discourse.processing.org/t/p5-license-and-p5-library-license-questions/38631)

<div class="topic-metadata">

**Author:** [@meezwhite](https://discourse.processing.org/u/meezwhite)\
**Replies:** 8\
**Last updated:** [September 5, 2022, 11:31pm UTC](https://discourse.processing.org/t/p5-license-and-p5-library-license-questions/38631 "2022-09-05T23:31:13Z")

</div>

Hi there! We’re currently developing a p5.js library and we have some questions regarding proper licensing. We would like our library to be licensed under the MIT License. Are we allowed to do this? Or would our libr…

---

## [HTML as texture in WEBGL](https://discourse.processing.org/t/html-as-texture-in-webgl/38600)

<div class="topic-metadata">

**Author:** [@vkbr](https://discourse.processing.org/u/vkbr)\
**Replies:** 0\
**Last updated:** [September 1, 2022, 1:01pm UTC](https://discourse.processing.org/t/html-as-texture-in-webgl/38600 "2022-09-01T13:01:00Z")

</div>

Hello. Is it possible to use a HTML as texture in a 3D object? Lets say I have a tweet card like this: That have been generated by a code like this (from tweet embed code, this is not the one for this particular tw…

---

## [Understanding p5 server side with node](https://discourse.processing.org/t/understanding-p5-server-side-with-node/38498)

<div class="topic-metadata">

**Author:** [@vkbr](https://discourse.processing.org/u/vkbr)\
**Replies:** 12\
**Last updated:** [August 30, 2022, 9:52am UTC](https://discourse.processing.org/t/understanding-p5-server-side-with-node/38498 "2022-08-30T09:52:58Z")

</div>

How does p5js and node integrate? There is 2 ways as I’ve found: serving a js file to be executed in the client and a implementation using node-canvas found at npm: node-p5 here. Although, I got a little confused, as the…

---

## [How to create a clean iframe](https://discourse.processing.org/t/how-to-create-a-clean-iframe/33753)

<div class="topic-metadata">

**Author:** [@sansonsan](https://discourse.processing.org/u/sansonsan)\
**Replies:** 12\
**Last updated:** [August 29, 2022, 8:38am UTC](https://discourse.processing.org/t/how-to-create-a-clean-iframe/33753 "2022-08-29T08:38:55Z")

</div>

Hello, I made a small code with p5js and I want to insert it with an iframe on my webpage. \<iframe frameborder="0"style="height: 300px; width: 300px; margin: 0 auto; display: block;" src="https://editor.p5js.org/sanson…

---

## [Processing to js issues help please!](https://discourse.processing.org/t/processing-to-js-issues-help-please/38537)

<div class="topic-metadata">

**Author:** [@yk7244](https://discourse.processing.org/u/yk7244)\
**Replies:** 0\
**Last updated:** [August 29, 2022, 1:57am UTC](https://discourse.processing.org/t/processing-to-js-issues-help-please/38537 "2022-08-29T01:57:32Z")

</div>

Hello everyone, I’m struggling changing my processing pde code to js (p5js) especially with class part. Could you help me how to change this code? float accuracy = 99.1; boolean autoplay = false; boolean showsFPS = f…

---

## [How to check if something is on screen](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483)

<div class="topic-metadata">

**Author:** [@graph100](https://discourse.processing.org/u/graph100)\
**Replies:** 4\
**Last updated:** [August 25, 2022, 2:41pm UTC](https://discourse.processing.org/t/how-to-check-if-something-is-on-screen/38483 "2022-08-25T14:41:37Z")

</div>

Hi, I was wondering if there was a way to see if something is being displayed on the current canvas in WEBGL mode. I’m working on a game and i have a class of objects that i need to know if they are on screen (that inclu…

---

## [Combining matrix functions with applyMatrix()](https://discourse.processing.org/t/combining-matrix-functions-with-applymatrix/38475)

<div class="topic-metadata">

**Author:** [@Sunt](https://discourse.processing.org/u/Sunt)\
**Replies:** 2\
**Last updated:** [August 25, 2022, 2:31pm UTC](https://discourse.processing.org/t/combining-matrix-functions-with-applymatrix/38475 "2022-08-25T14:31:09Z")

</div>

Hi. In this code I have a rotating rectangle in the center of the canvas using the applyMatrix() function. In the reference it’s said that I can combine these functions into one. This is a powerful operation that can …

---

## [Advice to improve performance of a 3D model composed of many blocks](https://discourse.processing.org/t/advice-to-improve-performance-of-a-3d-model-composed-of-many-blocks/38446)

<div class="topic-metadata">

**Author:** [@ramith](https://discourse.processing.org/u/ramith)\
**Replies:** 11\
**Last updated:** [August 24, 2022, 4:11pm UTC](https://discourse.processing.org/t/advice-to-improve-performance-of-a-3d-model-composed-of-many-blocks/38446 "2022-08-24T16:11:54Z")

</div>

Hi ! I’m trying to display several layers like the one depicted below. it’s basically a grid of 64 x 64 box() elements each having a different thickness (i read those values from a .mat file at the start). It occured …

---

## [Problem on displaying fonts in webgl on some devices](https://discourse.processing.org/t/problem-on-displaying-fonts-in-webgl-on-some-devices/38329)

<div class="topic-metadata">

**Author:** [@Parabola](https://discourse.processing.org/u/Parabola)\
**Replies:** 2\
**Last updated:** [August 23, 2022, 5:30pm UTC](https://discourse.processing.org/t/problem-on-displaying-fonts-in-webgl-on-some-devices/38329 "2022-08-23T17:30:41Z")

</div>

Hi folks! Is have a strange issue thats driving me insane and cant figure out the problem Im kinda new to p5js and have a little experience with processing java. I’ve made a lyrics visualizer sketch for a friends song…

---

## [How does the P5 web editor sandbox code?](https://discourse.processing.org/t/how-does-the-p5-web-editor-sandbox-code/38456)

<div class="topic-metadata">

**Author:** [@dayetown](https://discourse.processing.org/u/dayetown)\
**Replies:** 1\
**Last updated:** [August 22, 2022, 4:39pm UTC](https://discourse.processing.org/t/how-does-the-p5-web-editor-sandbox-code/38456 "2022-08-22T16:39:24Z")

</div>

How does the P5 web editor take user code and run it while disallowing malicious user access. Does it simply use the eval function? Or does it interpret a subset of js on its own? Or neither? Asking because I’d like to …

---

## [Does anyone know how to link a library into the online p5.js editor?](https://discourse.processing.org/t/does-anyone-know-how-to-link-a-library-into-the-online-p5-js-editor/38444)

<div class="topic-metadata">

**Author:** [@RobinChase](https://discourse.processing.org/u/RobinChase)\
**Replies:** 2\
**Last updated:** [August 22, 2022, 3:36pm UTC](https://discourse.processing.org/t/does-anyone-know-how-to-link-a-library-into-the-online-p5-js-editor/38444 "2022-08-22T15:36:50Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Does anyone know how to create a link in HTML in order to use the different libraries that are suggested on the P5.js website?

---

## [Advice regarding reading .mat file in p5.js](https://discourse.processing.org/t/advice-regarding-reading-mat-file-in-p5-js/38437)

<div class="topic-metadata">

**Author:** [@ramith](https://discourse.processing.org/u/ramith)\
**Replies:** 5\
**Last updated:** [August 21, 2022, 6:40pm UTC](https://discourse.processing.org/t/advice-regarding-reading-mat-file-in-p5-js/38437 "2022-08-21T18:40:21Z")

</div>

Hi ! A js newbie here… I’m trying to read a .mat file through p5.js I found this library, but cannot quite integrate it with p5.js Any pointers would be really helpful. Thanks!!

---

## [createShader with texture not working](https://discourse.processing.org/t/createshader-with-texture-not-working/38407)

<div class="topic-metadata">

**Author:** [@PauRosello](https://discourse.processing.org/u/PauRosello)\
**Replies:** 0\
**Last updated:** [August 18, 2022, 1:58pm UTC](https://discourse.processing.org/t/createshader-with-texture-not-working/38407 "2022-08-18T13:58:10Z")

</div>

Hi, the following example works if instead of using createShader() in setup() I use loadShader() in preload(), but I need to use createShader because I need the shader code to be in the script file. Is there something I’…

---

## [Checkbox style size](https://discourse.processing.org/t/checkbox-style-size/38406)

<div class="topic-metadata">

**Author:** [@Sunt](https://discourse.processing.org/u/Sunt)\
**Replies:** 2\
**Last updated:** [August 18, 2022, 1:18pm UTC](https://discourse.processing.org/t/checkbox-style-size/38406 "2022-08-18T13:18:51Z")

</div>

Hi, I am trying to change the size of the checkbox. The font size property works but not the box size. Thanks in advance. checkbox = createCheckbox('label', true); checkbox.style("font-size", '46px'); checkbox.s…

---

## [Programmatically uncheck a check box](https://discourse.processing.org/t/programmatically-uncheck-a-check-box/38393)

<div class="topic-metadata">

**Author:** [@Sunt](https://discourse.processing.org/u/Sunt)\
**Replies:** 3\
**Last updated:** [August 17, 2022, 4:39pm UTC](https://discourse.processing.org/t/programmatically-uncheck-a-check-box/38393 "2022-08-17T16:39:36Z")

</div>

Hi. How can I programmatically uncheck a check box.? I’ve searched and tried a lot of things like checkbox.elt.disabled = false; But nothing works. Thanks in advance.

---

## [Hi ,who can tell me the way to upload a pic in P5.js editor? I am a beginner!](https://discourse.processing.org/t/hi-who-can-tell-me-the-way-to-upload-a-pic-in-p5-js-editor-i-am-a-beginner/38389)

<div class="topic-metadata">

**Author:** [@sallyzhai](https://discourse.processing.org/u/sallyzhai)\
**Replies:** 1\
**Last updated:** [August 17, 2022, 6:37am UTC](https://discourse.processing.org/t/hi-who-can-tell-me-the-way-to-upload-a-pic-in-p5-js-editor-i-am-a-beginner/38389 "2022-08-17T06:37:12Z")

</div>

Sorry, who can tell me the way to upload a picture in p5.js editor? They have changed the upload way from the previous one!

---

## [P5 in WEBGL crashes Chrome](https://discourse.processing.org/t/p5-in-webgl-crashes-chrome/38369)

<div class="topic-metadata">

**Author:** [@patakk](https://discourse.processing.org/u/patakk)\
**Replies:** 5\
**Last updated:** [August 15, 2022, 11:36pm UTC](https://discourse.processing.org/t/p5-in-webgl-crashes-chrome/38369 "2022-08-15T23:36:27Z")

</div>

Hello, let me first give you a minimal example that will crash Chrome on my PC (Windows 10, RTX 3080Ti, Ryzen 9 5950x). function setup(){ createCanvas(windowWidth, windowHeight, WEBGL); } function draw(){ back…

---

## [How to make score only go up by one when pressing spacebar?](https://discourse.processing.org/t/how-to-make-score-only-go-up-by-one-when-pressing-spacebar/38247)

<div class="topic-metadata">

**Author:** [@Mathamagic](https://discourse.processing.org/u/Mathamagic)\
**Replies:** 1\
**Last updated:** [August 15, 2022, 10:47pm UTC](https://discourse.processing.org/t/how-to-make-score-only-go-up-by-one-when-pressing-spacebar/38247 "2022-08-15T22:47:16Z")

</div>

I am trying to make a flappy bird clone and i was woundering how do i make it so that whenever you press the spacebar it increases the score by 1 and doesnt and more than 1 if you hold the space bar? let y = 200 ; let …

---

## [How can I break textToPoints into lines according to canvas width](https://discourse.processing.org/t/how-can-i-break-texttopoints-into-lines-according-to-canvas-width/38341)

<div class="topic-metadata">

**Author:** [@pedrocoelho](https://discourse.processing.org/u/pedrocoelho)\
**Replies:** 2\
**Last updated:** [August 15, 2022, 12:18pm UTC](https://discourse.processing.org/t/how-can-i-break-texttopoints-into-lines-according-to-canvas-width/38341 "2022-08-15T12:18:20Z")

</div>

I’m trying to adapt the Steering Behavior tutorial from the Coding Train and make it more responsive. I’m wondering how can I divide the text into lines according to some width value, like canvas width. I thought about…

---

## [Destroying p5.js instances](https://discourse.processing.org/t/destroying-p5-js-instances/38333)

<div class="topic-metadata">

**Author:** [@Ckyiu](https://discourse.processing.org/u/Ckyiu)\
**Replies:** 1\
**Last updated:** [August 13, 2022, 12:01am UTC](https://discourse.processing.org/t/destroying-p5-js-instances/38333 "2022-08-13T00:01:45Z")

</div>

I’m trying to run a p5.js sketch on my Gatsby website, and I’ve managed to get it to work by starting it in instance mode in useEffect in a component. It works, but since I’m using \<Link\> instead of \<a\> for a lot of link…

---

## [Translating javascript to Processing ---Uint32Array---](https://discourse.processing.org/t/translating-javascript-to-processing-uint32array/38323)

<div class="topic-metadata">

**Author:** [@jeykech](https://discourse.processing.org/u/jeykech)\
**Replies:** 3\
**Last updated:** [August 12, 2022, 4:07pm UTC](https://discourse.processing.org/t/translating-javascript-to-processing-uint32array/38323 "2022-08-12T16:07:04Z")

</div>

hi guys, please I need your help translating chi piece of code from P5 to Processing. I am working on a code and came across this one from this Skitch : QuadTree - OpenProcessing I am having trouble understanding the …

---

## [P5JS Slider problems](https://discourse.processing.org/t/p5js-slider-problems/38289)

<div class="topic-metadata">

**Author:** [@astrogeek](https://discourse.processing.org/u/astrogeek)\
**Replies:** 5\
**Last updated:** [August 10, 2022, 8:26pm UTC](https://discourse.processing.org/t/p5js-slider-problems/38289 "2022-08-10T20:26:25Z")

</div>

I’m working on a p5js data visualization that I want to control with sliders. I’ve successfully used sliders on an earlier visualization. I compared the html, js, and css files for my older successful project and my new …

---

## [Which face is which? Persistence faces tracking](https://discourse.processing.org/t/which-face-is-which-persistence-faces-tracking/38282)

<div class="topic-metadata">

**Author:** [@AndreasRef](https://discourse.processing.org/u/AndreasRef)\
**Replies:** 0\
**Last updated:** [August 9, 2022, 2:29pm UTC](https://discourse.processing.org/t/which-face-is-which-persistence-faces-tracking/38282 "2022-08-09T14:29:18Z")

</div>

Hi! I have this p5js sketch that uses tensorflow Blazeface to track faces. I was wondering how I would go about keeping track of multiple faces for an interactive installation I am doing? Kinda like Face-It/FaceDetec…

---

## [Fullscreen web app ios orientation bug?](https://discourse.processing.org/t/fullscreen-web-app-ios-orientation-bug/28734)

<div class="topic-metadata">

**Author:** [@rikitiki](https://discourse.processing.org/u/rikitiki)\
**Replies:** 2\
**Last updated:** [August 9, 2022, 3:32pm UTC](https://discourse.processing.org/t/fullscreen-web-app-ios-orientation-bug/28734 "2022-08-09T15:32:07Z")

</div>

Hello, I’m attempting to create an iPadOS/iOS webclip of my p5 code and I’m encountering some strange behavior on rotation with windowResized(). Rotation (and windowResize()) works fine within Safari, but as soon as I …

---

## [Processing code to p5.js code](https://discourse.processing.org/t/processing-code-to-p5-js-code/38250)

<div class="topic-metadata">

**Author:** [@carol](https://discourse.processing.org/u/carol)\
**Replies:** 2\
**Last updated:** [August 8, 2022, 5:30pm UTC](https://discourse.processing.org/t/processing-code-to-p5-js-code/38250 "2022-08-08T17:30:50Z")

</div>

Hey! I’m looking to change some Processing code into p5.js code. I tried the converter but it doesn’t seem to work on p5. I’m wondering if anyone can help transfer theProcessing code to p5.js. Please help! Thanks! float…

---

## [Using ES6 Modules in the p5.js Web Editor](https://discourse.processing.org/t/using-es6-modules-in-the-p5-js-web-editor/38258)

<div class="topic-metadata">

**Author:** [@Pieter](https://discourse.processing.org/u/Pieter)\
**Replies:** 4\
**Last updated:** [August 7, 2022, 4:32pm UTC](https://discourse.processing.org/t/using-es6-modules-in-the-p5-js-web-editor/38258 "2022-08-07T16:32:23Z")

</div>

I’m trying to use modules on the web editor, but I can’t seem to get it to work because it cannot resolve the relative paths. Is it even possible? Any help would be greatly appreciated, for my specific use case I want to…

---

## [Finding the x,y location of a word when text wrapped](https://discourse.processing.org/t/finding-the-x-y-location-of-a-word-when-text-wrapped/38243)

<div class="topic-metadata">

**Author:** [@sspboyd](https://discourse.processing.org/u/sspboyd)\
**Replies:** 4\
**Last updated:** [August 7, 2022, 10:48am UTC](https://discourse.processing.org/t/finding-the-x-y-location-of-a-word-when-text-wrapped/38243 "2022-08-07T10:48:10Z")

</div>

Is there a way to find the x,y location of a word in a string where the text is wrapped? I’ve made a simple example to illustrate my question. How would I go about finding the location of the first word in the third sen…

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

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