# p5.js

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

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

**Page:** 100

---

## [How to make curves with slight variations](https://discourse.processing.org/t/how-to-make-curves-with-slight-variations/8745)

<div class="topic-metadata">

**Author:** [@blkpanther](https://discourse.processing.org/u/blkpanther)\
**Replies:** 2\
**Last updated:** [February 28, 2019, 6:28pm UTC](https://discourse.processing.org/t/how-to-make-curves-with-slight-variations/8745 "2019-02-28T18:28:29Z")

</div>

I intend to make arrays of curves that line up like this. So far my code can only draw straight lines like this or relatively regular curves I wonder how to use curve functions to create an array of curves that doesn…

---

## [Display a text over an hovered area](https://discourse.processing.org/t/display-a-text-over-an-hovered-area/8706)

<div class="topic-metadata">

**Author:** [@sevaus](https://discourse.processing.org/u/sevaus)\
**Replies:** 13\
**Last updated:** [February 28, 2019, 1:01pm UTC](https://discourse.processing.org/t/display-a-text-over-an-hovered-area/8706 "2019-02-28T13:01:43Z")

</div>

Hello, Say I have several automata: https://imgur.com/a/bga8qgE and I want to have a text displayed when the user hovers any arc. How could I do this? The automata was created using the usual functions arc, rect, line …

---

## [Closing a shape with curveVertex till the end](https://discourse.processing.org/t/closing-a-shape-with-curvevertex-till-the-end/6566)

<div class="topic-metadata">

**Author:** [@animofa](https://discourse.processing.org/u/animofa)\
**Replies:** 15\
**Last updated:** [February 27, 2019, 4:12pm UTC](https://discourse.processing.org/t/closing-a-shape-with-curvevertex-till-the-end/6566 "2019-02-27T16:12:57Z")

</div>

Hello, I am currently working on a circular wave generator, that can be modified by users. To achieve it I am using curveVertex. beginShape(); let i =0; for(let a = 0; a \< TWO\_PI; a += ang){ i++; let sx = x + …

---

## [Using texture() with vertex()](https://discourse.processing.org/t/using-texture-with-vertex/8714)

<div class="topic-metadata">

**Author:** [@anthonygalea](https://discourse.processing.org/u/anthonygalea)\
**Replies:** 8\
**Last updated:** [February 27, 2019, 7:52am UTC](https://discourse.processing.org/t/using-texture-with-vertex/8714 "2019-02-27T07:52:31Z")

</div>

I can use texture() successfully with plane() but I can’t seem to figure out how to use it with vertex(). Does p5.js support using texture() with a shape built using vertex() calls like this: let pg; function setup() {…

---

## [Why stroke can effect text's display?](https://discourse.processing.org/t/why-stroke-can-effect-texts-display/8728)

<div class="topic-metadata">

**Author:** [@sheeeeep](https://discourse.processing.org/u/sheeeeep)\
**Replies:** 7\
**Last updated:** [February 27, 2019, 2:33am UTC](https://discourse.processing.org/t/why-stroke-can-effect-texts-display/8728 "2019-02-27T02:33:48Z")

</div>

Here is my example: function setup() { createCanvas(640, 480); } function draw() { background(200) textSize(20) text("Welcome", 0, 20) stroke(255, 0, 0) } This is code’s preview:

---

## [Get RGB values of a pixel on the canvas](https://discourse.processing.org/t/get-rgb-values-of-a-pixel-on-the-canvas/8719)

<div class="topic-metadata">

**Author:** [@Milky](https://discourse.processing.org/u/Milky)\
**Replies:** 12\
**Last updated:** [February 26, 2019, 6:49pm UTC](https://discourse.processing.org/t/get-rgb-values-of-a-pixel-on-the-canvas/8719 "2019-02-26T18:49:51Z")

</div>

I tried get() and pixels array, but they both didnt work cause get() is for when you load an image as I understand and pixels array for some reason just is full of the background color and no colors of lines I drew. How …

---

## [Getting GIFs to Play in a Random Order](https://discourse.processing.org/t/getting-gifs-to-play-in-a-random-order/8716)

<div class="topic-metadata">

**Author:** [@ratilomend](https://discourse.processing.org/u/ratilomend)\
**Replies:** 2\
**Last updated:** [February 26, 2019, 6:41pm UTC](https://discourse.processing.org/t/getting-gifs-to-play-in-a-random-order/8716 "2019-02-26T18:41:14Z")

</div>

Hi all, I’m relatively new to p5 and coding generally. I’m currently working on a project which requires several GIFs to play one after another in a random order. I understand that arrays might be the way to go but I’m …

---

## [P5.js on Chromebook offline without Linux?](https://discourse.processing.org/t/p5-js-on-chromebook-offline-without-linux/3422)

<div class="topic-metadata">

**Author:** [@steinlav](https://discourse.processing.org/u/steinlav)\
**Replies:** 2\
**Last updated:** [February 26, 2019, 12:27pm UTC](https://discourse.processing.org/t/p5-js-on-chromebook-offline-without-linux/3422 "2019-02-26T12:27:12Z")

</div>

Is it possible to run p5.js on a Chromebook offline without installing Linux? I have added Web Server for Chrome and Material Neutron. Is https://editor.p5js.org the best solution on a Chromebook?

---

## [Creating multiple class instances in p5?](https://discourse.processing.org/t/creating-multiple-class-instances-in-p5/8665)

<div class="topic-metadata">

**Author:** [@Maximos118](https://discourse.processing.org/u/Maximos118)\
**Replies:** 6\
**Last updated:** [February 24, 2019, 2:22am UTC](https://discourse.processing.org/t/creating-multiple-class-instances-in-p5/8665 "2019-02-24T02:22:03Z")

</div>

I’d like to create a potentially unlimited amount of instances of a certain class within my javascript document: let trees; const treespawn = () =\> { let x = random(50, windowWidth - 50); let y = random(windowHeight…

---

## [Homework Help for p5](https://discourse.processing.org/t/homework-help-for-p5/8650)

<div class="topic-metadata">

**Author:** [@ixd](https://discourse.processing.org/u/ixd)\
**Replies:** 1\
**Last updated:** [February 23, 2019, 10:37am UTC](https://discourse.processing.org/t/homework-help-for-p5/8650 "2019-02-23T10:37:35Z")

</div>

I need to answer these questions about the code below, and am having trouble understanding them… How many times does the loop body run each frame, once the x and y arrays are full? What are two ways of increasing t…

---

## [How to load sound in a web editor sketch?](https://discourse.processing.org/t/how-to-load-sound-in-a-web-editor-sketch/8640)

<div class="topic-metadata">

**Author:** [@tv42](https://discourse.processing.org/u/tv42)\
**Replies:** 1\
**Last updated:** [February 22, 2019, 10:47pm UTC](https://discourse.processing.org/t/how-to-load-sound-in-a-web-editor-sketch/8640 "2019-02-22T22:47:44Z")

</div>

https://editor.p5js.org/tv42/sketches/ejesQqE1v This sketch gives me a 404 error, even though the sound file appears in the project folder. Is something missing? Am I improperly using something from here?(https://p5js.o…

---

## [Class function looping/setInterval issues](https://discourse.processing.org/t/class-function-looping-setinterval-issues/8644)

<div class="topic-metadata">

**Author:** [@Maximos118](https://discourse.processing.org/u/Maximos118)\
**Replies:** 6\
**Last updated:** [February 22, 2019, 7:57pm UTC](https://discourse.processing.org/t/class-function-looping-setinterval-issues/8644 "2019-02-22T19:57:20Z")

</div>

Ok, I’m trying to do something rather tricky here in p5. Take a look at my shudder class inside my Trees class: function draw() { background(0, 111, 10); trees.trunk(); trees.leaves(); trees.shudder(); } class Tr…

---

## [Calling classes that won't loop](https://discourse.processing.org/t/calling-classes-that-wont-loop/8623)

<div class="topic-metadata">

**Author:** [@Maximos118](https://discourse.processing.org/u/Maximos118)\
**Replies:** 3\
**Last updated:** [February 22, 2019, 11:32am UTC](https://discourse.processing.org/t/calling-classes-that-wont-loop/8623 "2019-02-22T11:32:23Z")

</div>

Hi there! I’m currently working on a game with p5 which will include some pretty complicated stuff… at least for me anyway. Hopefully you good looking people will help me to finish it in the future! Anyway my first of m…

---

## [How to specify the audio format for recording?](https://discourse.processing.org/t/how-to-specify-the-audio-format-for-recording/8609)

<div class="topic-metadata">

**Author:** [@hollo](https://discourse.processing.org/u/hollo)\
**Replies:** 0\
**Last updated:** [February 21, 2019, 11:26pm UTC](https://discourse.processing.org/t/how-to-specify-the-audio-format-for-recording/8609 "2019-02-21T23:26:28Z")

</div>

I would like to record audio for a telephony application in 8kHz, uLaw codec but I do not see any method to specify the audio recording format for the record() function (sampling rate, channels, sample bit size, codec) …

---

## [Load csv file with createfileinput](https://discourse.processing.org/t/load-csv-file-with-createfileinput/8488)

<div class="topic-metadata">

**Author:** [@tatecaarson](https://discourse.processing.org/u/tatecaarson)\
**Replies:** 9\
**Last updated:** [February 21, 2019, 4:27am UTC](https://discourse.processing.org/t/load-csv-file-with-createfileinput/8488 "2019-02-21T04:27:52Z")

</div>

I am trying to load a csv file with loadTable after a user uploads it with createFileInput. I can get createFileInput to work if i’m using an image but not with loadTable. Here’s the important bit of code: input = creat…

---

## [Feedback for rollover buttons](https://discourse.processing.org/t/feedback-for-rollover-buttons/8484)

<div class="topic-metadata">

**Author:** [@mmartinez2187](https://discourse.processing.org/u/mmartinez2187)\
**Replies:** 1\
**Last updated:** [February 21, 2019, 12:33am UTC](https://discourse.processing.org/t/feedback-for-rollover-buttons/8484 "2019-02-21T00:33:34Z")

</div>

HI! I am not sure if i am doing this right but I wanted to create multiple rollover buttons using overRect() and overCircle() When I move my mouse over to the other shapes on the canvas, they don’t change colors; howev…

---

## [Is there a way to find the drop of a song using p5.js audio module?](https://discourse.processing.org/t/is-there-a-way-to-find-the-drop-of-a-song-using-p5-js-audio-module/8424)

<div class="topic-metadata">

**Author:** [@Mako](https://discourse.processing.org/u/Mako)\
**Replies:** 4\
**Last updated:** [February 20, 2019, 4:14am UTC](https://discourse.processing.org/t/is-there-a-way-to-find-the-drop-of-a-song-using-p5-js-audio-module/8424 "2019-02-20T04:14:38Z")

</div>

Is there a way to find the drop of a song using p5.js audio module? How should I proceed ? Thank you for your time

---

## [DOM lib - how to specify container node?](https://discourse.processing.org/t/dom-lib-how-to-specify-container-node/8487)

<div class="topic-metadata">

**Author:** [@kirkjerk](https://discourse.processing.org/u/kirkjerk)\
**Replies:** 11\
**Last updated:** [February 18, 2019, 12:35am UTC](https://discourse.processing.org/t/dom-lib-how-to-specify-container-node/8487 "2019-02-18T00:35:15Z")

</div>

http://p5js.org/reference/#/p5/createSlider says “Appends to the container node if one is specified, otherwise appends to body.” A. how is it specified? It doesn’t seem to be any of the arguments B. how do I get a vali…

---

## [Is it possible to crawl editor.p5js.org sketches?](https://discourse.processing.org/t/is-it-possible-to-crawl-editor-p5js-org-sketches/8333)

<div class="topic-metadata">

**Author:** [@wooble](https://discourse.processing.org/u/wooble)\
**Replies:** 2\
**Last updated:** [February 17, 2019, 10:50pm UTC](https://discourse.processing.org/t/is-it-possible-to-crawl-editor-p5js-org-sketches/8333 "2019-02-17T22:50:52Z")

</div>

I’m curious about the projects people have created and the way code is being written on the p5 editor.

---

## [Why does my code not work](https://discourse.processing.org/t/why-does-my-code-not-work/8394)

<div class="topic-metadata">

**Author:** [@babaramdev](https://discourse.processing.org/u/babaramdev)\
**Replies:** 2\
**Last updated:** [February 16, 2019, 8:49pm UTC](https://discourse.processing.org/t/why-does-my-code-not-work/8394 "2019-02-16T20:49:41Z")

</div>

let x\_vals = \[\]; //List of x-values let y\_vals = \[\]; let shapeDone = 0; //When shapeDone = 0, the shape has not been completed. When shapeDone = 1, the shape is completed. let numberOfSides = 0; let area=0; var listOfAll…

---

## [JavaScript Basic Question](https://discourse.processing.org/t/javascript-basic-question/8434)

<div class="topic-metadata">

**Author:** [@ixd](https://discourse.processing.org/u/ixd)\
**Replies:** 1\
**Last updated:** [February 16, 2019, 2:29am UTC](https://discourse.processing.org/t/javascript-basic-question/8434 "2019-02-16T02:29:18Z")

</div>

How can I make it so that the grass is “cut” at a certain height? I think I should be changing something in line 21, but not sure… also, when the grass is cut, all that happens is a white rectangle is being placed over …

---

## [P5.js Prim's Algorithm Maze Generation: Stuck in Infinite Loop](https://discourse.processing.org/t/p5-js-prims-algorithm-maze-generation-stuck-in-infinite-loop/8277)

<div class="topic-metadata">

**Author:** [@henrydavidzhu](https://discourse.processing.org/u/henrydavidzhu)\
**Replies:** 2\
**Last updated:** [February 15, 2019, 9:05pm UTC](https://discourse.processing.org/t/p5-js-prims-algorithm-maze-generation-stuck-in-infinite-loop/8277 "2019-02-15T21:05:59Z")

</div>

Note: Posted this question on StackOverflow and received answers there: https://stackoverflow.com/questions/54613229/p5-js-prims-algorithm-maze-generation-stuck-in-infinite-loop/54621408#54621408 I’m trying on implement…

---

## [P5js video error: Element play method raised an error asynchronously DOMException](https://discourse.processing.org/t/p5js-video-error-element-play-method-raised-an-error-asynchronously-domexception/8358)

<div class="topic-metadata">

**Author:** [@AndreasRef](https://discourse.processing.org/u/AndreasRef)\
**Replies:** 3\
**Last updated:** [February 15, 2019, 9:49am UTC](https://discourse.processing.org/t/p5js-video-error-element-play-method-raised-an-error-asynchronously-domexception/8358 "2019-02-15T09:49:30Z")

</div>

I have a question about an error I get when I want to have a video play in my p5js sketch: WARN: Element play method raised an error asynchronously DOMException If I press the canvas first with my mouse, the error does…

---

## [P5 simple game Question](https://discourse.processing.org/t/p5-simple-game-question/8415)

<div class="topic-metadata">

**Author:** [@helpmeimnew](https://discourse.processing.org/u/helpmeimnew)\
**Replies:** 6\
**Last updated:** [February 15, 2019, 8:06am UTC](https://discourse.processing.org/t/p5-simple-game-question/8415 "2019-02-15T08:06:51Z")

</div>

I am learning how to animate sprites and one video really helped. But now i am anxious to know how to use the mouse clicked function (i think) to stop the said animation clicked. While also having the animation change i…

---

## [Help with speeding up a fractal calculation](https://discourse.processing.org/t/help-with-speeding-up-a-fractal-calculation/8232)

<div class="topic-metadata">

**Author:** [@Dan](https://discourse.processing.org/u/Dan)\
**Replies:** 7\
**Last updated:** [February 13, 2019, 9:10pm UTC](https://discourse.processing.org/t/help-with-speeding-up-a-fractal-calculation/8232 "2019-02-13T21:10:27Z")

</div>

Hi everyone, I’ve used p5.js to render a fractal image by running Newton’s method on each pixel in a 600 by 600 grid. This works well enough for rendering the image once, and my result looks like this: But, this ima…

---

## [Why text label upon mouseover doesn't work in this p5 code?](https://discourse.processing.org/t/why-text-label-upon-mouseover-doesnt-work-in-this-p5-code/8339)

<div class="topic-metadata">

**Author:** [@blkpanther](https://discourse.processing.org/u/blkpanther)\
**Replies:** 1\
**Last updated:** [February 13, 2019, 3:04am UTC](https://discourse.processing.org/t/why-text-label-upon-mouseover-doesnt-work-in-this-p5-code/8339 "2019-02-13T03:04:52Z")

</div>

I have a code drawing ellipses based on input data, and there is supposed to be text label on the ellipses upon mouse rollover, but so far that doesn’t work. If I remove if (this.over) condition, the label shows. If…

---

## [Clicked() function? \[Resolved\]](https://discourse.processing.org/t/clicked-function-resolved/8179)

<div class="topic-metadata">

**Author:** [@laurenstrader](https://discourse.processing.org/u/laurenstrader)\
**Replies:** 2\
**Last updated:** [February 12, 2019, 5:33am UTC](https://discourse.processing.org/t/clicked-function-resolved/8179 "2019-02-12T05:33:59Z")

</div>

Hello, I am following the Coding Train 7.4 tutorial, if anyone has seen this, and I am unable to allow the program to recognize when I click inside the circles. In the video, the functions are formatted like this: funct…

---

## [Unable to open the Javascript console in windows 10 PC using chrome](https://discourse.processing.org/t/unable-to-open-the-javascript-console-in-windows-10-pc-using-chrome/8303)

<div class="topic-metadata">

**Author:** [@nisthesecond](https://discourse.processing.org/u/nisthesecond)\
**Replies:** 5\
**Last updated:** [February 12, 2019, 12:59am UTC](https://discourse.processing.org/t/unable-to-open-the-javascript-console-in-windows-10-pc-using-chrome/8303 "2019-02-12T00:59:42Z")

</div>

I am unable to open the Javascript console in a PC running Windows 10 using chrome Browser. I get the following error message after pressing Control+Shift+J. I get this error message: Failed to load resource: the serv…

---

## [Detect when a button is being pressed down](https://discourse.processing.org/t/detect-when-a-button-is-being-pressed-down/8289)

<div class="topic-metadata">

**Author:** [@AndreasRef](https://discourse.processing.org/u/AndreasRef)\
**Replies:** 5\
**Last updated:** [February 11, 2019, 4:08pm UTC](https://discourse.processing.org/t/detect-when-a-button-is-being-pressed-down/8289 "2019-02-11T16:08:29Z")

</div>

Hey, a simple question: if I have an html button, how can I detect when the button is being pressed. I am not interested in doing something when the button is clicked, but instead in doing something for the entire time t…

---

## [Changing CENTER point of a vertex Shape for rotation](https://discourse.processing.org/t/changing-center-point-of-a-vertex-shape-for-rotation/8239)

<div class="topic-metadata">

**Author:** [@hellonearthis](https://discourse.processing.org/u/hellonearthis)\
**Replies:** 2\
**Last updated:** [February 9, 2019, 10:12am UTC](https://discourse.processing.org/t/changing-center-point-of-a-vertex-shape-for-rotation/8239 "2019-02-09T10:12:57Z")

</div>

In this sketch, I’m trying to changing CENTER point of a vertex Shape so I can easily do rotation on it. In processing there is shapeMode but P5 doesn’t currently have that. (well post a feature request soonish). I had…

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

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