# Coding Questions

**URL:** https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=8

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

**Page:** 9

---

## [Mix video with static images added later to canvas](https://discourse.processing.org/t/mix-video-with-static-images-added-later-to-canvas/38743)

<div class="topic-metadata">

**Author:** [@slgdev](https://discourse.processing.org/u/slgdev)\
**Replies:** 2\
**Last updated:** [September 15, 2022, 12:35am UTC](https://discourse.processing.org/t/mix-video-with-static-images-added-later-to-canvas/38743 "2022-09-15T00:35:14Z")

</div>

Dear Community, since many years im a designer and webdev and just came across p5.js - It blows my mind, there are so much things i can imagine :slight\_smile: Please have a look here: https://editor.p5js.org/slgdev/sk…

---

## [Help with adding autocomplete to a sketch](https://discourse.processing.org/t/help-with-adding-autocomplete-to-a-sketch/38440)

<div class="topic-metadata">

**Author:** [@zara2355](https://discourse.processing.org/u/zara2355)\
**Replies:** 13\
**Last updated:** [September 14, 2022, 1:24pm UTC](https://discourse.processing.org/t/help-with-adding-autocomplete-to-a-sketch/38440 "2022-09-14T13:24:03Z")

</div>

Hi all- Im hoping someone might be able to help point me in the right direction. Im creating a sketch that acts as an interactive inventory map for the shop that i work in. For example, when a person types in a search t…

---

## [Coding a system with sun moon and earth realistically](https://discourse.processing.org/t/coding-a-system-with-sun-moon-and-earth-realistically/38712)

<div class="topic-metadata">

**Author:** [@Beppo](https://discourse.processing.org/u/Beppo)\
**Replies:** 1\
**Last updated:** [September 11, 2022, 4:08pm UTC](https://discourse.processing.org/t/coding-a-system-with-sun-moon-and-earth-realistically/38712 "2022-09-11T16:08:29Z")

</div>

Hi, I am asking my question again because i still couldnt improve: Hello, for a scool project I have to code the in the reality existing system containing sun, moon and earth as realistically as possible. In my opinion …

---

## [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…

---

## [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…

---

## [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’…

---

## [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…

---

## [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 …

---

## [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…

---

## [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…

---

## [Quad in WEBGL is hidden or shown with diagonal line](https://discourse.processing.org/t/quad-in-webgl-is-hidden-or-shown-with-diagonal-line/38233)

<div class="topic-metadata">

**Author:** [@yedu](https://discourse.processing.org/u/yedu)\
**Replies:** 3\
**Last updated:** [August 6, 2022, 8:14am UTC](https://discourse.processing.org/t/quad-in-webgl-is-hidden-or-shown-with-diagonal-line/38233 "2022-08-06T08:14:18Z")

</div>

In the following code, I expect to see two quads displayed on the canvas, but only the blue one shows up, and it shows up with a diagonal line between its two vertexes. How can I get rid of the diagonal line? How come …

---

## [Does anyone know how to convert processing to p5.js?](https://discourse.processing.org/t/does-anyone-know-how-to-convert-processing-to-p5-js/38212)

<div class="topic-metadata">

**Author:** [@Dazsha](https://discourse.processing.org/u/Dazsha)\
**Replies:** 1\
**Last updated:** [August 3, 2022, 5:03pm UTC](https://discourse.processing.org/t/does-anyone-know-how-to-convert-processing-to-p5-js/38212 "2022-08-03T17:03:25Z")

</div>

please format code with \</\> button \* homework policy \* asking questions This is the processing code that I’d like to convert Particle\[\] particles; float alpha; void setup() { size(1112, 834); background(0); …

---

## [P5.js Copy Tool](https://discourse.processing.org/t/p5-js-copy-tool/38109)

<div class="topic-metadata">

**Author:** [@courserastudent16](https://discourse.processing.org/u/courserastudent16)\
**Replies:** 2\
**Last updated:** [July 27, 2022, 8:34am UTC](https://discourse.processing.org/t/p5-js-copy-tool/38109 "2022-07-27T08:34:29Z")

</div>

Hello, I hope everyone is doing well. I’m trying to create a copy tool using P5.js. I’m using a constructor function to make the tool. What should I add to this function below? I want the copy button to work shapes. …

---

## [P5.js Text Box Tool](https://discourse.processing.org/t/p5-js-text-box-tool/38092)

<div class="topic-metadata">

**Author:** [@courserastudent16](https://discourse.processing.org/u/courserastudent16)\
**Replies:** 6\
**Last updated:** [July 26, 2022, 4:26pm UTC](https://discourse.processing.org/t/p5-js-text-box-tool/38092 "2022-07-26T16:26:18Z")

</div>

Hello, I hope everyone is doing well. I’m trying to create a textbox using P5.js. I’m using a constructor function to make the tool. Please let me know what I’m doing here. function textBox(p) { this.name = 'textB…

---

## [Monet Art loop issue](https://discourse.processing.org/t/monet-art-loop-issue/38089)

<div class="topic-metadata">

**Author:** [@druchtie](https://discourse.processing.org/u/druchtie)\
**Replies:** 9\
**Last updated:** [July 25, 2022, 6:56pm UTC](https://discourse.processing.org/t/monet-art-loop-issue/38089 "2022-07-25T18:56:30Z")

</div>

Hi, I have been watching some tutorials this weekend and came across a tutorial that I started to tweak to create some Monet-like artworks from my pictures. The only problem is that it has some strange behavior on the ri…

---

## [P5.js Redo Tool](https://discourse.processing.org/t/p5-js-redo-tool/38095)

<div class="topic-metadata">

**Author:** [@courserastudent16](https://discourse.processing.org/u/courserastudent16)\
**Replies:** 2\
**Last updated:** [July 25, 2022, 10:29am UTC](https://discourse.processing.org/t/p5-js-redo-tool/38095 "2022-07-25T10:29:08Z")

</div>

Hello, I hope everyone is doing well. I’m trying to create a redo tool using P5.js. I’m using a constructor function to make the tool. What should I add to this function below? I want the redo button to work shapes. …

---

## [P5.js Undo Tool](https://discourse.processing.org/t/p5-js-undo-tool/38093)

<div class="topic-metadata">

**Author:** [@courserastudent16](https://discourse.processing.org/u/courserastudent16)\
**Replies:** 3\
**Last updated:** [July 25, 2022, 10:24am UTC](https://discourse.processing.org/t/p5-js-undo-tool/38093 "2022-07-25T10:24:39Z")

</div>

Hello, I hope everyone is doing well. I’m trying to create an undo tool using P5.js. I’m using a constructor function to make the tool. What should I add to this function below? I want the undo button to work shapes. …

---

## [Inner/Outer Stroke Offset Possible?](https://discourse.processing.org/t/inner-outer-stroke-offset-possible/38075)

<div class="topic-metadata">

**Author:** [@arbo](https://discourse.processing.org/u/arbo)\
**Replies:** 7\
**Last updated:** [July 24, 2022, 11:06pm UTC](https://discourse.processing.org/t/inner-outer-stroke-offset-possible/38075 "2022-07-24T23:06:11Z")

</div>

Using P5js, is it possible to create either an inner or outer equidistant stroke line which follows the contour of the shape? Take for example the image below. if I had the capitol letter ‘E’ and wanted to draw the inn…

---

## [Save p5js-Script to ipfs with correct MimeType](https://discourse.processing.org/t/save-p5js-script-to-ipfs-with-correct-mimetype/38077)

<div class="topic-metadata">

**Author:** [@res56](https://discourse.processing.org/u/res56)\
**Replies:** 0\
**Last updated:** [July 24, 2022, 4:49pm UTC](https://discourse.processing.org/t/save-p5js-script-to-ipfs-with-correct-mimetype/38077 "2022-07-24T16:49:20Z")

</div>

Hello everyone, I want to save a p5js Script to ipfs with node.js It is necassary to store the script in a string value. What is the smartest way to set the Mimetype to application/javascript so the Browser is able to …

---

## [Display 1 character (from a choice of 4) in an animation](https://discourse.processing.org/t/display-1-character-from-a-choice-of-4-in-an-animation/38068)

<div class="topic-metadata">

**Author:** [@E-maniak](https://discourse.processing.org/u/E-maniak)\
**Replies:** 4\
**Last updated:** [July 23, 2022, 7:50pm UTC](https://discourse.processing.org/t/display-1-character-from-a-choice-of-4-in-an-animation/38068 "2022-07-23T19:50:46Z")

</div>

Hello, I am trying to create an animation with : TV (fixed) clouds (mobile) a character (not moving) I would like the character to be random at each load (a witch, a mage, an angel and an astronaut). Unfortunately, …

---

## [Unexpected behavior from a shader in p5](https://discourse.processing.org/t/unexpected-behavior-from-a-shader-in-p5/38041)

<div class="topic-metadata">

**Author:** [@neel](https://discourse.processing.org/u/neel)\
**Replies:** 2\
**Last updated:** [July 21, 2022, 12:41pm UTC](https://discourse.processing.org/t/unexpected-behavior-from-a-shader-in-p5/38041 "2022-07-21T12:41:28Z")

</div>

I’ve got a shader that I’m trying to run in p5, but it doesn’t work as expected. If I copy this fragment shader into editor.thebookofshaders.com, it generates a gradient that’s black on the left and red on the right. Whe…

---

## [Using my own data in a P5.js sketch?](https://discourse.processing.org/t/using-my-own-data-in-a-p5-js-sketch/37983)

<div class="topic-metadata">

**Author:** [@mamba76](https://discourse.processing.org/u/mamba76)\
**Replies:** 10\
**Last updated:** [July 18, 2022, 8:42pm UTC](https://discourse.processing.org/t/using-my-own-data-in-a-p5-js-sketch/37983 "2022-07-18T20:42:53Z")

</div>

How can I load my JSON file, containing an array of x / y coordinates, into my sketch program so I can draw a graph ?

---

## [Combining classes and instance mode in p5js?](https://discourse.processing.org/t/combining-classes-and-instance-mode-in-p5js/38006)

<div class="topic-metadata">

**Author:** [@basicvisual](https://discourse.processing.org/u/basicvisual)\
**Replies:** 1\
**Last updated:** [July 17, 2022, 6:37pm UTC](https://discourse.processing.org/t/combining-classes-and-instance-mode-in-p5js/38006 "2022-07-17T18:37:30Z")

</div>

Hi recently I came across the topic of running sketches in p5js in an instance mode. I had been able to draw shapes and do basic visualization using the instance mode. However I am quite confused when it comes in dealing…

---

## [Parallel for loops in p5js](https://discourse.processing.org/t/parallel-for-loops-in-p5js/37997)

<div class="topic-metadata">

**Author:** [@mldvxcc](https://discourse.processing.org/u/mldvxcc)\
**Replies:** 0\
**Last updated:** [July 17, 2022, 4:19am UTC](https://discourse.processing.org/t/parallel-for-loops-in-p5js/37997 "2022-07-17T04:19:28Z")

</div>

I was wondering if it is possible to run parallel for loops in JavaScript using the p5js library? I am trying to speed up the following code and run multiple points in parallel given each is independent. \< for (ix = 0…

---

## [Array of new p5 instance & DOM](https://discourse.processing.org/t/array-of-new-p5-instance-dom/37964)

<div class="topic-metadata">

**Author:** [@louise00](https://discourse.processing.org/u/louise00)\
**Replies:** 1\
**Last updated:** [July 15, 2022, 10:57am UTC](https://discourse.processing.org/t/array-of-new-p5-instance-dom/37964 "2022-07-15T10:57:10Z")

</div>

Hello I have been building a script with a fractal grid wherein a more complicated vector shape is created per grid square and I want to be able to crop the shape into its square but without turning it into a bitmap imag…

---

## [P5js error when adding a function call to draw()](https://discourse.processing.org/t/p5js-error-when-adding-a-function-call-to-draw/37934)

<div class="topic-metadata">

**Author:** [@Steve](https://discourse.processing.org/u/Steve)\
**Replies:** 0\
**Last updated:** [July 12, 2022, 6:06pm UTC](https://discourse.processing.org/t/p5js-error-when-adding-a-function-call-to-draw/37934 "2022-07-12T18:06:56Z")

</div>

I’m working on a sketch as part of a raycasting course and I keep seeing the error “TypeError: e.set is not a function” and my CPU spins up to 100% which kills browser performance. I can reproduce this a couple differen…

[Previous page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=7)

[Next page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=9)
