# p5.js

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

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

**Page:** 72

---

## [Moving Fractal Tree Space colonisation according to hand position (posenet)](https://discourse.processing.org/t/moving-fractal-tree-space-colonisation-according-to-hand-position-posenet/20737)

<div class="topic-metadata">

**Author:** [@yuinjann](https://discourse.processing.org/u/yuinjann)\
**Replies:** 2\
**Last updated:** [May 15, 2020, 3:14am UTC](https://discourse.processing.org/t/moving-fractal-tree-space-colonisation-according-to-hand-position-posenet/20737 "2020-05-15T03:14:44Z")

</div>

Hello! So I have this sketch that modifies Daniel Shiffman’s p5.js \[Coding Challenge #17: Fractal Trees - Space Colonization \]. Using posenet, the leaves are generated by my left hand, and the root of the tree is generat…

---

## [Older, deleted image keeps loading instead of newer one with the same name](https://discourse.processing.org/t/older-deleted-image-keeps-loading-instead-of-newer-one-with-the-same-name/20746)

<div class="topic-metadata">

**Author:** [@Vera](https://discourse.processing.org/u/Vera)\
**Replies:** 4\
**Last updated:** [May 14, 2020, 7:22pm UTC](https://discourse.processing.org/t/older-deleted-image-keeps-loading-instead-of-newer-one-with-the-same-name/20746 "2020-05-14T19:22:22Z")

</div>

I’m using the web editor. I have an array with a number of images in it. I added a new image and I accidentally uploaded the wrong file first. Because the naming structure is related to the array, the second, right imag…

---

## [defaultCanvas problem](https://discourse.processing.org/t/defaultcanvas-problem/20776)

<div class="topic-metadata">

**Author:** [@TDSV](https://discourse.processing.org/u/TDSV)\
**Replies:** 4\
**Last updated:** [May 14, 2020, 10:51am UTC](https://discourse.processing.org/t/defaultcanvas-problem/20776 "2020-05-14T10:51:26Z")

</div>

Hello I have a problem with p5js, I use video capture. The code works well and is displayed correctly. But by associating my P5Js with my HTML, I have two defaultCanvas that appear in my HTML when I inspect. one with my…

---

## [Loading an array of images on mouse position - going from processing to p5.js](https://discourse.processing.org/t/loading-an-array-of-images-on-mouse-position-going-from-processing-to-p5-js/20780)

<div class="topic-metadata">

**Author:** [@mixel](https://discourse.processing.org/u/mixel)\
**Replies:** 1\
**Last updated:** [May 12, 2020, 10:19pm UTC](https://discourse.processing.org/t/loading-an-array-of-images-on-mouse-position-going-from-processing-to-p5-js/20780 "2020-05-12T22:19:19Z")

</div>

Hi, I’ve created this working code in processing and would like to implement it on a website - I am completely new to this, so I am not sure whether or not it is possible to convert this to p5.js with just a few changes…

---

## [How do I enable/disable a selection box?](https://discourse.processing.org/t/how-do-i-enable-disable-a-selection-box/20656)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 4\
**Last updated:** [May 12, 2020, 5:34pm UTC](https://discourse.processing.org/t/how-do-i-enable-disable-a-selection-box/20656 "2020-05-12T17:34:46Z")

</div>

Is this possible? I know that I can disable options in a selection box via .disable(option) but I’d like to be able to enable/disable the box itself.

---

## [Multiple seed values for noise](https://discourse.processing.org/t/multiple-seed-values-for-noise/20695)

<div class="topic-metadata">

**Author:** [@shinyogre](https://discourse.processing.org/u/shinyogre)\
**Replies:** 3\
**Last updated:** [May 12, 2020, 8:02am UTC](https://discourse.processing.org/t/multiple-seed-values-for-noise/20695 "2020-05-12T08:02:03Z")

</div>

I have multiple layers of 1D perlin noise rendering with vertices via beginShape() and endShape(). I noticed however that because each layer uses the same noise seed, their shape is quite similar and the effect is a les…

---

## [Is it possible to get the index of the array object that called a function?](https://discourse.processing.org/t/is-it-possible-to-get-the-index-of-the-array-object-that-called-a-function/20769)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 6:09am UTC](https://discourse.processing.org/t/is-it-possible-to-get-the-index-of-the-array-object-that-called-a-function/20769 "2020-05-12T06:09:47Z")

</div>

So I learned some time ago on this forum that the same function can be called by a button press and it’s possible to determine which button did the pressing: function buttonPressListener(){ switch (this) { c…

---

## [Trademark Guidelines?](https://discourse.processing.org/t/trademark-guidelines/20631)

<div class="topic-metadata">

**Author:** [@NFellenor](https://discourse.processing.org/u/NFellenor)\
**Replies:** 1\
**Last updated:** [May 12, 2020, 3:45am UTC](https://discourse.processing.org/t/trademark-guidelines/20631 "2020-05-12T03:45:49Z")

</div>

Hello I have been using p5.js in my Computer Science dissertation project (an open audio web platform); one of the requirements is to make a poster promoting our product. I was wondering if I am allowed to use the p5.js …

---

## [Error 502 randomly occurs when the project is shared](https://discourse.processing.org/t/error-502-randomly-occurs-when-the-project-is-shared/20028)

<div class="topic-metadata">

**Author:** [@paco06](https://discourse.processing.org/u/paco06)\
**Replies:** 1\
**Last updated:** [May 11, 2020, 10:57pm UTC](https://discourse.processing.org/t/error-502-randomly-occurs-when-the-project-is-shared/20028 "2020-05-11T22:57:52Z")

</div>

Hello I’m a P5.js newby…I developed 4 years ago a processing program and moved it to p5.js. It loads and works fine in the preview window. My problem occurs when I share the program, the program loading time increase ran…

---

## [Get rid of sound distortion](https://discourse.processing.org/t/get-rid-of-sound-distortion/20696)

<div class="topic-metadata">

**Author:** [@mhr](https://discourse.processing.org/u/mhr)\
**Replies:** 2\
**Last updated:** [May 11, 2020, 2:41pm UTC](https://discourse.processing.org/t/get-rid-of-sound-distortion/20696 "2020-05-11T14:41:02Z")

</div>

Hi, I’m trying to play tiny parts of the same sound file through MouseDragged function on p5. Everything works just fine when the variables are defined in the begining, but I want to be able to change them using the ke…

---

## [FFT with video as a source](https://discourse.processing.org/t/fft-with-video-as-a-source/20729)

<div class="topic-metadata">

**Author:** [@ballinoates](https://discourse.processing.org/u/ballinoates)\
**Replies:** 0\
**Last updated:** [May 10, 2020, 11:24pm UTC](https://discourse.processing.org/t/fft-with-video-as-a-source/20729 "2020-05-10T23:24:46Z")

</div>

Hi all- trying to use p5js for a new project instead of P3 and having some issues. I normally use minim for all my FFT related coding but that is not available for p5js. Anyway, I have a local video (for now) that I wa…

---

## [Question concerning p5.js](https://discourse.processing.org/t/question-concerning-p5-js/20703)

<div class="topic-metadata">

**Author:** [@salisha](https://discourse.processing.org/u/salisha)\
**Replies:** 1\
**Last updated:** [May 10, 2020, 6:09am UTC](https://discourse.processing.org/t/question-concerning-p5-js/20703 "2020-05-10T06:09:52Z")

</div>

Hi all, I have a little problem using p5.js. I uploaded a personal jpeg image to p5.js web editor and I will now like to add butterflies to it. Just a few butterflies to be flying/moving about the image that I uploaded…

---

## [3d custom shape fill outside stroke](https://discourse.processing.org/t/3d-custom-shape-fill-outside-stroke/20661)

<div class="topic-metadata">

**Author:** [@dehyde](https://discourse.processing.org/u/dehyde)\
**Replies:** 1\
**Last updated:** [May 10, 2020, 6:07am UTC](https://discourse.processing.org/t/3d-custom-shape-fill-outside-stroke/20661 "2020-05-10T06:07:29Z")

</div>

I’m trying to recreate a code that ran well in Processing 3 When the shape is not a plane but has different z values for some vertexes - it fills the shape very strangely. Any ideas how to avoid this? This is how it l…

---

## [Change canvas rendering dynamically](https://discourse.processing.org/t/change-canvas-rendering-dynamically/20663)

<div class="topic-metadata">

**Author:** [@Golum](https://discourse.processing.org/u/Golum)\
**Replies:** 6\
**Last updated:** [May 9, 2020, 11:08pm UTC](https://discourse.processing.org/t/change-canvas-rendering-dynamically/20663 "2020-05-09T23:08:56Z")

</div>

Hello everybody ! I’m currently coding a small app which allows to create 2D shapes and display then in 3D. The html code creates 1 button for 2D rendering and another one for 3D rendering. In the p5.js file, I create…

---

## [Looking for help downloading from editor with interactive sketch](https://discourse.processing.org/t/looking-for-help-downloading-from-editor-with-interactive-sketch/20669)

<div class="topic-metadata">

**Author:** [@calfish](https://discourse.processing.org/u/calfish)\
**Replies:** 2\
**Last updated:** [May 9, 2020, 10:03pm UTC](https://discourse.processing.org/t/looking-for-help-downloading-from-editor-with-interactive-sketch/20669 "2020-05-09T22:03:46Z")

</div>

Hello, I am relatively new to p5 and am running into a problem I would really love help with. I am in the beginning stages of an interactive art piece. When I download my sketch from the web editor and try and open it,…

---

## [Getting sounds to play in mobile?](https://discourse.processing.org/t/getting-sounds-to-play-in-mobile/20673)

<div class="topic-metadata">

**Author:** [@calfish](https://discourse.processing.org/u/calfish)\
**Replies:** 2\
**Last updated:** [May 9, 2020, 9:06pm UTC](https://discourse.processing.org/t/getting-sounds-to-play-in-mobile/20673 "2020-05-09T21:06:56Z")

</div>

hi, I have a sketch where sounds are playing automatically when the sketch it launched and then the user can adjust volume. However, no sounds are playing when I open the sketch online via iphone. does anyone know how …

---

## [Filling 1D noise optimally](https://discourse.processing.org/t/filling-1d-noise-optimally/20666)

<div class="topic-metadata">

**Author:** [@shinyogre](https://discourse.processing.org/u/shinyogre)\
**Replies:** 2\
**Last updated:** [May 9, 2020, 2:42pm UTC](https://discourse.processing.org/t/filling-1d-noise-optimally/20666 "2020-05-09T14:42:59Z")

</div>

I am generating vertices using perlin noise and making a shape out of them with beginShape() and endShape(). I am then scrolling to the left while generating more vertices on the right. https://editor.p5js.org/shinyogr…

---

## [Animating the loadImage function?](https://discourse.processing.org/t/animating-the-loadimage-function/20629)

<div class="topic-metadata">

**Author:** [@cuvner](https://discourse.processing.org/u/cuvner)\
**Replies:** 3\
**Last updated:** [May 9, 2020, 9:23am UTC](https://discourse.processing.org/t/animating-the-loadimage-function/20629 "2020-05-09T09:23:17Z")

</div>

Here is my code for a 3d spinning cube and using texture to lay images from an array, json file, to project on to the cube. The image update currently is at the sketch frame rate and I want to control the update speed b…

---

## [How to work with TextBounds in instance mode](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654)

<div class="topic-metadata">

**Author:** [@murillazo](https://discourse.processing.org/u/murillazo)\
**Replies:** 2\
**Last updated:** [May 9, 2020, 7:23am UTC](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654 "2020-05-09T07:23:53Z")

</div>

Hi, I have the following problem, when I try to use textBounds on instance mode im not sure how to do it, is reporting me this error -\> Unable to get property ‘unitsPerEm’ of undefined or null reference. let name = "t…

---

## [Combining PoseNet with Daniel Shiffman's Fractal Trees Example to create leaves](https://discourse.processing.org/t/combining-posenet-with-daniel-shiffmans-fractal-trees-example-to-create-leaves/20532)

<div class="topic-metadata">

**Author:** [@yuinjann](https://discourse.processing.org/u/yuinjann)\
**Replies:** 10\
**Last updated:** [May 9, 2020, 5:46am UTC](https://discourse.processing.org/t/combining-posenet-with-daniel-shiffmans-fractal-trees-example-to-create-leaves/20532 "2020-05-09T05:46:50Z")

</div>

Hi! I’m trying to create a project with posenet and using Daniel Shiffman’s Coding Challenge #17: Fractal Trees - Space Colonization. Using his example, instead of the leaves generating randomly, I want them to only gen…

---

## [Weird behaviour with mouseX and mouseY](https://discourse.processing.org/t/weird-behaviour-with-mousex-and-mousey/20618)

<div class="topic-metadata">

**Author:** [@LinemanForTheCounty](https://discourse.processing.org/u/LinemanForTheCounty)\
**Replies:** 5\
**Last updated:** [May 8, 2020, 9:37pm UTC](https://discourse.processing.org/t/weird-behaviour-with-mousex-and-mousey/20618 "2020-05-08T21:37:47Z")

</div>

Whenever i retrieve mouseX and mouseY , mouseX returns as long decimal number and mouseY returns as a integer. (ex. \[340.32472970811324, 350\]). This is quite annoying as it broke one of my functions. Does anyone have a…

---

## [Nested function?](https://discourse.processing.org/t/nested-function/20639)

<div class="topic-metadata">

**Author:** [@noel](https://discourse.processing.org/u/noel)\
**Replies:** 1\
**Last updated:** [May 8, 2020, 5:59pm UTC](https://discourse.processing.org/t/nested-function/20639 "2020-05-08T17:59:24Z")

</div>

I am making my first steps in P5.js, and trying to translate some js to java code, but I don’t understand the function below. It seems some nested function. How can I translate this? let particles = \[\]; function draw()…

---

## [Performance. Is there any way to make work faster?](https://discourse.processing.org/t/performance-is-there-any-way-to-make-work-faster/20183)

<div class="topic-metadata">

**Author:** [@kmorozov](https://discourse.processing.org/u/kmorozov)\
**Replies:** 3\
**Last updated:** [May 8, 2020, 6:02am UTC](https://discourse.processing.org/t/performance-is-there-any-way-to-make-work-faster/20183 "2020-05-08T06:02:24Z")

</div>

Hi all. I’m trying to study p5js and desided to rewrite some sketch from processing to p5js. Here it is - https://www.openprocessing.org/sketch/882019. Original tutorial in processing is here - https://timrodenbroeker.…

---

## [How do I make an input box accept numbers only?](https://discourse.processing.org/t/how-do-i-make-an-input-box-accept-numbers-only/20572)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 9\
**Last updated:** [May 7, 2020, 10:26pm UTC](https://discourse.processing.org/t/how-do-i-make-an-input-box-accept-numbers-only/20572 "2020-05-07T22:26:43Z")

</div>

let x=createInput("", "number"); creates a textbox with tiny scrollbars to scroll through the numbers and can also have negative numbers. I want to create a textbox so that people can put in their age.

---

## [Can't open p5.js sketch on mobile which works on mac](https://discourse.processing.org/t/cant-open-p5-js-sketch-on-mobile-which-works-on-mac/20557)

<div class="topic-metadata">

**Author:** [@lohoso](https://discourse.processing.org/u/lohoso)\
**Replies:** 4\
**Last updated:** [May 7, 2020, 9:27am UTC](https://discourse.processing.org/t/cant-open-p5-js-sketch-on-mobile-which-works-on-mac/20557 "2020-05-07T09:27:52Z")

</div>

https://editor.p5js.org/lohoso/present/Td-myBfmT The sketch works on laptop, but does not work on my iPhone. Anyone can help?

---

## [Seeking p5 data visualization help](https://discourse.processing.org/t/seeking-p5-data-visualization-help/20334)

<div class="topic-metadata">

**Author:** [@felixthefein](https://discourse.processing.org/u/felixthefein)\
**Replies:** 4\
**Last updated:** [May 7, 2020, 1:35am UTC](https://discourse.processing.org/t/seeking-p5-data-visualization-help/20334 "2020-05-07T01:35:29Z")

</div>

Hello, I am new to p5, and I am creating a simple data visualization about wind using data from an accelerometer (in a .csv file). My “x” values are represented by the variable sensorx, and my “y” values are represente…

---

## [How do I find out all the methods that are available to an object?](https://discourse.processing.org/t/how-do-i-find-out-all-the-methods-that-are-available-to-an-object/20571)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 2\
**Last updated:** [May 7, 2020, 1:06am UTC](https://discourse.processing.org/t/how-do-i-find-out-all-the-methods-that-are-available-to-an-object/20571 "2020-05-07T01:06:35Z")

</div>

I want to know all the methods that are part of a button or input box. The reference doesn’t list them all I think.

---

## [removeAll in p5.js (vs Processing)](https://discourse.processing.org/t/removeall-in-p5-js-vs-processing/20566)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 10\
**Last updated:** [May 6, 2020, 10:48pm UTC](https://discourse.processing.org/t/removeall-in-p5-js-vs-processing/20566 "2020-05-06T22:48:51Z")

</div>

There is a bug in the removeAll() function that has been fixed, but will only be available in the next release. EDIT: moved from Processing thread

---

## [On Chrome, createSlider with instance mode makes duplicated sliders](https://discourse.processing.org/t/on-chrome-createslider-with-instance-mode-makes-duplicated-sliders/20531)

<div class="topic-metadata">

**Author:** [@ahirose](https://discourse.processing.org/u/ahirose)\
**Replies:** 3\
**Last updated:** [May 6, 2020, 12:05pm UTC](https://discourse.processing.org/t/on-chrome-createslider-with-instance-mode-makes-duplicated-sliders/20531 "2020-05-06T12:05:07Z")

</div>

Hi all, Thank you for your effort to keep the quality of this great community. I just tried to port a createSlider example to the instance mode then hit a issue. How can I solve it? Following is my code, it’s working …

---

## [Looping a texture on 3D Shape that Reacts to Slider Adjustments](https://discourse.processing.org/t/looping-a-texture-on-3d-shape-that-reacts-to-slider-adjustments/20528)

<div class="topic-metadata">

**Author:** [@mzerby](https://discourse.processing.org/u/mzerby)\
**Replies:** 0\
**Last updated:** [May 6, 2020, 4:20am UTC](https://discourse.processing.org/t/looping-a-texture-on-3d-shape-that-reacts-to-slider-adjustments/20528 "2020-05-06T04:20:19Z")

</div>

Hello! I am trying to figure out how to create a looping texture on a 3D that will restart after it has filled the shape to reflect the adjustment made with the slider. I currently have a texture that is a spiral pattern…

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

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