# Coding Questions

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

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

**Page:** 43

---

## [Porting p5.processing Arraylist question](https://discourse.processing.org/t/porting-p5-processing-arraylist-question/11869)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 3\
**Last updated:** [June 5, 2019, 6:35pm UTC](https://discourse.processing.org/t/porting-p5-processing-arraylist-question/11869 "2019-06-05T18:35:36Z")

</div>

I’m trying to port over some code, from p5 ( this is the second environment I’ve learned to code in, the first being Khan academy). So I don’t understand all the concepts that Java utilises. However what seems like a sim…

---

## [Using clear() correctly, Magic Leap Example](https://discourse.processing.org/t/using-clear-correctly-magic-leap-example/11747)

<div class="topic-metadata">

**Author:** [@Zevensuy](https://discourse.processing.org/u/Zevensuy)\
**Replies:** 1\
**Last updated:** [June 2, 2019, 6:04am UTC](https://discourse.processing.org/t/using-clear-correctly-magic-leap-example/11747 "2019-06-02T06:04:57Z")

</div>

Hi all, I am working on some examples of using p5js with the Magic Leap One Headset. The Magic Leap comes built in with its own browser called Helios. One of the “tricks” that the browser can do is set basically a transp…

---

## [Help, with projectile motion in game](https://discourse.processing.org/t/help-with-projectile-motion-in-game/11760)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 3\
**Last updated:** [June 1, 2019, 7:16pm UTC](https://discourse.processing.org/t/help-with-projectile-motion-in-game/11760 "2019-06-01T19:16:56Z")

</div>

I’m making a game with a digger, at the moment I’ve added a fire mechanism which shoots little projectile, this was just a test to see if I could code it. It works however I do not understand how to adjust for the vehicl…

---

## [So close... how to display images from RSS](https://discourse.processing.org/t/so-close-how-to-display-images-from-rss/11750)

<div class="topic-metadata">

**Author:** [@Artie\_veirkant\_sux](https://discourse.processing.org/u/Artie_veirkant_sux)\
**Replies:** 0\
**Last updated:** [May 31, 2019, 11:36pm UTC](https://discourse.processing.org/t/so-close-how-to-display-images-from-rss/11750 "2019-05-31T23:36:29Z")

</div>

Hey again, Returning after some code tweaks, I still can’t get images to display from RSS. I’ve significantly refactored my code and have successfully created a tool for grabbing and loading images. The problem arises w…

---

## [Getting rid of input boxes later on / "encrypting passwords"](https://discourse.processing.org/t/getting-rid-of-input-boxes-later-on-encrypting-passwords/11709)

<div class="topic-metadata">

**Author:** [@CodeTime](https://discourse.processing.org/u/CodeTime)\
**Replies:** 4\
**Last updated:** [May 31, 2019, 1:53pm UTC](https://discourse.processing.org/t/getting-rid-of-input-boxes-later-on-encrypting-passwords/11709 "2019-05-31T13:53:36Z")

</div>

So I am trying to make a facebook imitation for practice. I was able to make the full front page, where you can sign up and log in and everything. My problem right now is that the input boxes do not disappear when you go…

---

## [Animating lines with 3 different positions](https://discourse.processing.org/t/animating-lines-with-3-different-positions/11731)

<div class="topic-metadata">

**Author:** [@antoniofrom1984](https://discourse.processing.org/u/antoniofrom1984)\
**Replies:** 1\
**Last updated:** [May 31, 2019, 1:45pm UTC](https://discourse.processing.org/t/animating-lines-with-3-different-positions/11731 "2019-05-31T13:45:07Z")

</div>

https://editor.p5js.org/antoniofrom1984/sketches/8n9le2Wvh In my project i have 2 lines. Each line changes position when you click on the screen. The position of each line always falls randomly in thirds of the screen…

---

## [Create mulitple ''pages'' in p5.js](https://discourse.processing.org/t/create-mulitple-pages-in-p5-js/11471)

<div class="topic-metadata">

**Author:** [@maxah999](https://discourse.processing.org/u/maxah999)\
**Replies:** 11\
**Last updated:** [May 30, 2019, 4:22pm UTC](https://discourse.processing.org/t/create-mulitple-pages-in-p5-js/11471 "2019-05-30T16:22:27Z")

</div>

Hi there ! I’m trying to recode the game found in https://www.humanbenchmark.com/tests/reactiontime for a project. I tried multiple things but i’m a slow learner when it comes to code, and i’m trying to create it one sl…

---

## [How to create small increment in random number](https://discourse.processing.org/t/how-to-create-small-increment-in-random-number/11669)

<div class="topic-metadata">

**Author:** [@noob](https://discourse.processing.org/u/noob)\
**Replies:** 9\
**Last updated:** [May 30, 2019, 3:10am UTC](https://discourse.processing.org/t/how-to-create-small-increment-in-random-number/11669 "2019-05-30T03:10:55Z")

</div>

Hi All I have been stuck this problem for few days. Couldn’t figure it out how create small increment in random number. This is my code: var jitter; function setup() { createCanvas(400, 400); background(220); s…

---

## [Steps to nodes again](https://discourse.processing.org/t/steps-to-nodes-again/11619)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 1\
**Last updated:** [May 28, 2019, 5:19pm UTC](https://discourse.processing.org/t/steps-to-nodes-again/11619 "2019-05-28T17:19:36Z")

</div>

https://editor.p5js.org/paulgoux/sketches/eiY8BkMUm So I’m trying to calculate the steps in between each node, and this is working seemingly ok, however some will be out by about 1-5 steps. I don’t understand whats caus…

---

## [P5 js 3D texture not loaded on iOS](https://discourse.processing.org/t/p5-js-3d-texture-not-loaded-on-ios/11562)

<div class="topic-metadata">

**Author:** [@jinbread](https://discourse.processing.org/u/jinbread)\
**Replies:** 1\
**Last updated:** [May 26, 2019, 2:40pm UTC](https://discourse.processing.org/t/p5-js-3d-texture-not-loaded-on-ios/11562 "2019-05-26T14:40:40Z")

</div>

Hi, I am trying to make the code below on web and mobile. As you can see, the web seems to be fine, but when I try to open it on the mobile, it shows nothing. I assume, there is some problem with loading texture, but n…

---

## [Beginner needing help with coding sketch](https://discourse.processing.org/t/beginner-needing-help-with-coding-sketch/11533)

<div class="topic-metadata">

**Author:** [@kelsierose94](https://discourse.processing.org/u/kelsierose94)\
**Replies:** 6\
**Last updated:** [May 26, 2019, 4:19am UTC](https://discourse.processing.org/t/beginner-needing-help-with-coding-sketch/11533 "2019-05-26T04:19:41Z")

</div>

Hi everyone! I’m a beginner coder (as in, learnt a few months ago) and a project I’m working on requires me to make a mini game. Here is what I have: https://editor.p5js.org/kelsierose94/sketches/ha9-e5FAw the yellow …

---

## [How to give suggestions in input box?](https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492)

<div class="topic-metadata">

**Author:** [@CodeTime](https://discourse.processing.org/u/CodeTime)\
**Replies:** 3\
**Last updated:** [May 22, 2019, 2:27pm UTC](https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492 "2019-05-22T14:27:20Z")

</div>

I have created an input box where a user can type and I do things later on with what they type in. I was wondering if there was any way in p5.js to put grey text in the input box to “suggest” what the user is to type in,…

---

## [How to pass arguments to new sketch in instance mode](https://discourse.processing.org/t/how-to-pass-arguments-to-new-sketch-in-instance-mode/11453)

<div class="topic-metadata">

**Author:** [@TimR](https://discourse.processing.org/u/TimR)\
**Replies:** 2\
**Last updated:** [May 22, 2019, 6:49am UTC](https://discourse.processing.org/t/how-to-pass-arguments-to-new-sketch-in-instance-mode/11453 "2019-05-22T06:49:27Z")

</div>

Hey all, Is there a way to pass an arguments array/object to a new sketch in instance mode? I would like to pass settings to the new sketch, like information on who is it’s parent element. But this could also be used t…

---

## [Factal trees grow as mousePressed](https://discourse.processing.org/t/factal-trees-grow-as-mousepressed/11089)

<div class="topic-metadata">

**Author:** [@youyou0032](https://discourse.processing.org/u/youyou0032)\
**Replies:** 3\
**Last updated:** [May 21, 2019, 3:47pm UTC](https://discourse.processing.org/t/factal-trees-grow-as-mousepressed/11089 "2019-05-21T15:47:51Z")

</div>

Hi Everyone I am a beginner in coding and I am working on my first official project. I followed the Coding challenge #14 Fractal tree. It works and very well. I am very happy. And then, I want to change the growth of …

---

## [Video as gl texture setup?](https://discourse.processing.org/t/video-as-gl-texture-setup/11427)

<div class="topic-metadata">

**Author:** [@jedierikb](https://discourse.processing.org/u/jedierikb)\
**Replies:** 4\
**Last updated:** [May 21, 2019, 12:28pm UTC](https://discourse.processing.org/t/video-as-gl-texture-setup/11427 "2019-05-21T12:28:41Z")

</div>

Trying to get a video as a gl texture: https://codepen.io/jedierikb/pen/MdvqGp Any suggestions what steps I missed to get the video to appear as a texture? Much appreciated, thanks!

---

## [How to get atributes from sketch it's parent element](https://discourse.processing.org/t/how-to-get-atributes-from-sketch-its-parent-element/11452)

<div class="topic-metadata">

**Author:** [@TimR](https://discourse.processing.org/u/TimR)\
**Replies:** 3\
**Last updated:** [May 21, 2019, 7:34am UTC](https://discourse.processing.org/t/how-to-get-atributes-from-sketch-its-parent-element/11452 "2019-05-21T07:34:27Z")

</div>

I’ve made a P5 sketch in instance mode. Now, I wanted to get to know some of the settings from it’s parent element. Like dimensions. For this I thought a good starting point would be to be able to know who is it’s paren…

---

## [How do I load images from and array of URLs?](https://discourse.processing.org/t/how-do-i-load-images-from-and-array-of-urls/11435)

<div class="topic-metadata">

**Author:** [@Artie\_veirkant\_sux](https://discourse.processing.org/u/Artie_veirkant_sux)\
**Replies:** 5\
**Last updated:** [May 21, 2019, 5:59am UTC](https://discourse.processing.org/t/how-do-i-load-images-from-and-array-of-urls/11435 "2019-05-21T05:59:51Z")

</div>

Hey all, Snatching URLs from RSS, I’ve been able to populate an array of links; ran into some issues loading the images. Trying to use that array outside of its class has been problematic, and I don’t know where to plac…

---

## [Error on loadJSON](https://discourse.processing.org/t/error-on-loadjson/11439)

<div class="topic-metadata">

**Author:** [@thealex23ro](https://discourse.processing.org/u/thealex23ro)\
**Replies:** 9\
**Last updated:** [May 21, 2019, 2:33am UTC](https://discourse.processing.org/t/error-on-loadjson/11439 "2019-05-21T02:33:23Z")

</div>

I’m attempting to save some data but i’m getting the following error: XML Parsing Error: syntax error Location: file:///path/JS/Domino/data/test.json Line Number 1, Column 1: (there’s nothing after de colon) I tried…

---

## [Is it possible to trim a curveVertex() shape?](https://discourse.processing.org/t/is-it-possible-to-trim-a-curvevertex-shape/11314)

<div class="topic-metadata">

**Author:** [@nardove](https://discourse.processing.org/u/nardove)\
**Replies:** 9\
**Last updated:** [May 20, 2019, 5:40pm UTC](https://discourse.processing.org/t/is-it-possible-to-trim-a-curvevertex-shape/11314 "2019-05-20T17:40:02Z")

</div>

Hi, I’m drawing a curveVertex shape by adding a point(x,y) at different intervals of time, this points are stored in an array, the array is use to draw the curve. When my object goes to the edge of the screen, I render…

---

## [Drop CSV file to loadTable()](https://discourse.processing.org/t/drop-csv-file-to-loadtable/11324)

<div class="topic-metadata">

**Author:** [@phoebus](https://discourse.processing.org/u/phoebus)\
**Replies:** 4\
**Last updated:** [May 19, 2019, 10:40am UTC](https://discourse.processing.org/t/drop-csv-file-to-loadtable/11324 "2019-05-19T10:40:04Z")

</div>

Hello I make a txt file with a header line, separated by commas, and some data lignes. ID, name, age, favorite color 00, Robert, 32, blue 01, Michele, 36, white If I use the drop() function, I get the file parameter t…

---

## [Check if a shape exists inside a complex shape](https://discourse.processing.org/t/check-if-a-shape-exists-inside-a-complex-shape/11176)

<div class="topic-metadata">

**Author:** [@Alisha](https://discourse.processing.org/u/Alisha)\
**Replies:** 4\
**Last updated:** [May 19, 2019, 6:43am UTC](https://discourse.processing.org/t/check-if-a-shape-exists-inside-a-complex-shape/11176 "2019-05-19T06:43:05Z")

</div>

I have a custom shape, which I made using: beginShape(LINES); vertex(190, 231); vertex(203, 143); vertex(203, 143); vertex(298, 153); vertex(298, 153); vertex(365,…

---

## [Travelling trees](https://discourse.processing.org/t/travelling-trees/11226)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 1\
**Last updated:** [May 16, 2019, 3:01pm UTC](https://discourse.processing.org/t/travelling-trees/11226 "2019-05-16T15:01:02Z")

</div>

Hi all, https://editor.p5js.org/paulgoux/sketches/NyWLGYBof I have made a program, which generates mazes, and I’m stuck when trying to count the steps from node to node. To be clear, I can generate the nodes, but I can…

---

## [Rotating entire space before animation](https://discourse.processing.org/t/rotating-entire-space-before-animation/11174)

<div class="topic-metadata">

**Author:** [@Avatrin](https://discourse.processing.org/u/Avatrin)\
**Replies:** 12\
**Last updated:** [May 16, 2019, 9:04am UTC](https://discourse.processing.org/t/rotating-entire-space-before-animation/11174 "2019-05-16T09:04:57Z")

</div>

Hi Look at the three dimensional animation here: https://p5js.org/reference/#/p5/applyMatrix Lets say I want it to rotate the opposite direction. However, instead of just changing the signs of the existing matrix, I w…

---

## [How to take control and/or remove the cursor?](https://discourse.processing.org/t/how-to-take-control-and-or-remove-the-cursor/11258)

<div class="topic-metadata">

**Author:** [@2000mater](https://discourse.processing.org/u/2000mater)\
**Replies:** 3\
**Last updated:** [May 16, 2019, 8:15am UTC](https://discourse.processing.org/t/how-to-take-control-and-or-remove-the-cursor/11258 "2019-05-16T08:15:11Z")

</div>

Is there a way to ‘listen to’ where the mouse wanted to move even if there is no place for it? Basically telling the program the same data the touchpad or mouse would give the device. I’ve seen cases where the page aske…

---

## [Converting from java to p5js, not working as intended](https://discourse.processing.org/t/converting-from-java-to-p5js-not-working-as-intended/11179)

<div class="topic-metadata">

**Author:** [@dakito](https://discourse.processing.org/u/dakito)\
**Replies:** 9\
**Last updated:** [May 15, 2019, 8:52pm UTC](https://discourse.processing.org/t/converting-from-java-to-p5js-not-working-as-intended/11179 "2019-05-15T20:52:35Z")

</div>

Just like the title says, I have absolutely no idea on what I am supposed to change. I fixed all error messages, replaced variable statements, changed the functions that I know I need to change. I am mostly a newbie to p…

---

## [Animating masks P5.js](https://discourse.processing.org/t/animating-masks-p5-js/11271)

<div class="topic-metadata">

**Author:** [@Hobie](https://discourse.processing.org/u/Hobie)\
**Replies:** 2\
**Last updated:** [May 15, 2019, 3:39pm UTC](https://discourse.processing.org/t/animating-masks-p5-js/11271 "2019-05-15T15:39:40Z")

</div>

Hello, For my thesis i’m researching generative design for online advertisements. I have been working with P5 to generate background visuals for SEAT. (this is a fictional case). I want to animate masks to display cert…

---

## [P5js Question: "Locking" the value of mouseX for event completion](https://discourse.processing.org/t/p5js-question-locking-the-value-of-mousex-for-event-completion/11112)

<div class="topic-metadata">

**Author:** [@cryptacritic](https://discourse.processing.org/u/cryptacritic)\
**Replies:** 10\
**Last updated:** [May 12, 2019, 10:47am UTC](https://discourse.processing.org/t/p5js-question-locking-the-value-of-mousex-for-event-completion/11112 "2019-05-12T10:47:39Z")

</div>

How can i store a value of X so that if some condition is met, it is equal to mouseX at the start of an event (like Keypressed)? I don’t want this value to change as i move the mouse, i want it to stay the same after the…

---

## [Access to normal](https://discourse.processing.org/t/access-to-normal/11221)

<div class="topic-metadata">

**Author:** [@vamoss](https://discourse.processing.org/u/vamoss)\
**Replies:** 1\
**Last updated:** [May 14, 2019, 1:14pm UTC](https://discourse.processing.org/t/access-to-normal/11221 "2019-05-14T13:14:42Z")

</div>

Hi, Anyone knows how do I get access to normals? I am trying to create a custom polygon, and it seems that the vertexNormals array is not accessible. Thanks!

---

## [Code Behaving Differently When Inside Function](https://discourse.processing.org/t/code-behaving-differently-when-inside-function/11183)

<div class="topic-metadata">

**Author:** [@PaulMaguire](https://discourse.processing.org/u/PaulMaguire)\
**Replies:** 2\
**Last updated:** [May 13, 2019, 9:20pm UTC](https://discourse.processing.org/t/code-behaving-differently-when-inside-function/11183 "2019-05-13T21:20:42Z")

</div>

I’ve been trying to create a sketch that moves a shape towards the mouse and then returns to a given starting point. This sketch does what I want with one shape but I want to have multiple shapes beginning from different…

---

## [\[SOLVED\] Porting 'Brightness.pde' to P5.js](https://discourse.processing.org/t/solved-porting-brightness-pde-to-p5-js/11155)

<div class="topic-metadata">

**Author:** [@jlsogorb](https://discourse.processing.org/u/jlsogorb)\
**Replies:** 2\
**Last updated:** [May 13, 2019, 4:04pm UTC](https://discourse.processing.org/t/solved-porting-brightness-pde-to-p5-js/11155 "2019-05-13T16:04:52Z")

</div>

Porting Brightnes.pde to P5.js Hi, I’m trying to port example of ‘Brightness’ from Processing to P5, and cannot do with success. The similar sample found in P5 reference is that (changing some things to transform it i…

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

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