# p5.js

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

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

**Page:** 97

---

## [The part that threw me off, "..., so that as it continues to increase,..."](https://discourse.processing.org/t/the-part-that-threw-me-off-so-that-as-it-continues-to-increase/10048)

<div class="topic-metadata">

**Author:** [@dougouverson](https://discourse.processing.org/u/dougouverson)\
**Replies:** 6\
**Last updated:** [April 11, 2019, 8:20pm UTC](https://discourse.processing.org/t/the-part-that-threw-me-off-so-that-as-it-continues-to-increase/10048 "2019-04-11T20:20:22Z")

</div>

Not sure if I’m not understanding the subject or if this sentence was not the best way to communicate behavior? Page 214 of “Getting Started with p5.js” The author communicates the arc behavior as such: “If it has, we…

---

## [Curve vertex contour problem](https://discourse.processing.org/t/curve-vertex-contour-problem/10179)

<div class="topic-metadata">

**Author:** [@mkoch](https://discourse.processing.org/u/mkoch)\
**Replies:** 1\
**Last updated:** [April 11, 2019, 9:39am UTC](https://discourse.processing.org/t/curve-vertex-contour-problem/10179 "2019-04-11T09:39:01Z")

</div>

Hello everyone, I have a problem using the beginContour and endContour methods with curve vertices. The contour is not rendered like expected. Here I’ve got a simple example of the problem https://editor.p5js.org/mko…

---

## [Access properties of a sketch's container in instance mode](https://discourse.processing.org/t/access-properties-of-a-sketchs-container-in-instance-mode/10088)

<div class="topic-metadata">

**Author:** [@surmvoise](https://discourse.processing.org/u/surmvoise)\
**Replies:** 4\
**Last updated:** [April 10, 2019, 11:59pm UTC](https://discourse.processing.org/t/access-properties-of-a-sketchs-container-in-instance-mode/10088 "2019-04-10T23:59:31Z")

</div>

How do I access properties of a sketch’s container in instance mode? I’d like to run multiple sketches in all the div’s with a certain class on a page. And I’d like to make the width of these sketches the same as the wi…

---

## [Cycling through array of audio files, need to go to next audio file](https://discourse.processing.org/t/cycling-through-array-of-audio-files-need-to-go-to-next-audio-file/9833)

<div class="topic-metadata">

**Author:** [@dackdel](https://discourse.processing.org/u/dackdel)\
**Replies:** 3\
**Last updated:** [April 10, 2019, 2:01pm UTC](https://discourse.processing.org/t/cycling-through-array-of-audio-files-need-to-go-to-next-audio-file/9833 "2019-04-10T14:01:41Z")

</div>

When speech is detected then the first track plays, it plays till the end and then turns the mic on to listen for something, when it hears something it plays the second track and so on until track ten. Running this code…

---

## [Erasing text or lines?](https://discourse.processing.org/t/erasing-text-or-lines/10104)

<div class="topic-metadata">

**Author:** [@joba1](https://discourse.processing.org/u/joba1)\
**Replies:** 4\
**Last updated:** [April 10, 2019, 7:30am UTC](https://discourse.processing.org/t/erasing-text-or-lines/10104 "2019-04-10T07:30:52Z")

</div>

Hi, I’m new to p5.js (and js in general) and stumbled over this while playing around with the first learning examples. Not sure if Beginners category is only for processing, so I post here: If I write a text in black o…

---

## [Wacom stylus in combination with P5js](https://discourse.processing.org/t/wacom-stylus-in-combination-with-p5js/10085)

<div class="topic-metadata">

**Author:** [@jns](https://discourse.processing.org/u/jns)\
**Replies:** 2\
**Last updated:** [April 9, 2019, 7:26pm UTC](https://discourse.processing.org/t/wacom-stylus-in-combination-with-p5js/10085 "2019-04-09T19:26:43Z")

</div>

Hello everybody, I am wondering if there is a way to use WACOM tablets in combination with P5js. A short google research did not yield any results. Best, Jonas

---

## [Can p5.js output valid lottie-files?](https://discourse.processing.org/t/can-p5-js-output-valid-lottie-files/10134)

<div class="topic-metadata">

**Author:** [@oivvio](https://discourse.processing.org/u/oivvio)\
**Replies:** 4\
**Last updated:** [April 9, 2019, 4:51pm UTC](https://discourse.processing.org/t/can-p5-js-output-valid-lottie-files/10134 "2019-04-09T16:51:20Z")

</div>

On a related note: Is it possible have processing output valid lottie-files?

---

## [How would I apply randomSeed( )](https://discourse.processing.org/t/how-would-i-apply-randomseed/10054)

<div class="topic-metadata">

**Author:** [@dougouverson](https://discourse.processing.org/u/dougouverson)\
**Replies:** 15\
**Last updated:** [April 9, 2019, 3:02pm UTC](https://discourse.processing.org/t/how-would-i-apply-randomseed/10054 "2019-04-09T15:02:52Z")

</div>

Page 221 - 223 - Example 8-9: Move Shapes Randomly At the end of the example, there’s a NOTE about randomSeed( ). I checked out the Reference at https://p5js.org/reference/#/p5/randomSeed I’m trying to figure out how t…

---

## [Moving the camera around](https://discourse.processing.org/t/moving-the-camera-around/6567)

<div class="topic-metadata">

**Author:** [@philippe](https://discourse.processing.org/u/philippe)\
**Replies:** 9\
**Last updated:** [April 9, 2019, 2:15pm UTC](https://discourse.processing.org/t/moving-the-camera-around/6567 "2019-04-09T14:15:55Z")

</div>

I’m trying to move the the camera (with the keyboard) in my 3d sketch but can’t get things working. i’ve tried with and without the Camera() function the result is always a mess ! Could someone give me an hint : for e…

---

## [Follow vector path](https://discourse.processing.org/t/follow-vector-path/9189)

<div class="topic-metadata">

**Author:** [@matyas](https://discourse.processing.org/u/matyas)\
**Replies:** 3\
**Last updated:** [March 11, 2019, 9:38pm UTC](https://discourse.processing.org/t/follow-vector-path/9189 "2019-03-11T21:38:48Z")

</div>

Hi Everyone, I am searching for a solution to move objects along vector paths (ex.: svg). I thought is a simple thing as the AE Lottie plugin is using something similar (AE animations converted to SVG - JSON to reproduc…

---

## [mousePressed() function](https://discourse.processing.org/t/mousepressed-function/9714)

<div class="topic-metadata">

**Author:** [@Neo\_Wang](https://discourse.processing.org/u/Neo_Wang)\
**Replies:** 11\
**Last updated:** [April 9, 2019, 10:45am UTC](https://discourse.processing.org/t/mousepressed-function/9714 "2019-04-09T10:45:11Z")

</div>

Hi there, from my understanding is that code within the mousePressed() function will be triggered when mouse is pressed down.however, what I was trying to do was draw a circle at a point on canvas when mouse is being pre…

---

## [Unable to get data from .JSON files](https://discourse.processing.org/t/unable-to-get-data-from-json-files/9971)

<div class="topic-metadata">

**Author:** [@peachman](https://discourse.processing.org/u/peachman)\
**Replies:** 6\
**Last updated:** [April 9, 2019, 6:50am UTC](https://discourse.processing.org/t/unable-to-get-data-from-json-files/9971 "2019-04-09T06:50:28Z")

</div>

Hi All, I have been able to get data from JSON files before, but i am unable to get data from this one ‘https://www.osrsbox.com/osrsbox-db/items-json-slot/items-2h.json’ function preload(){ items = loadJSON('https://w…

---

## [Loop bug in applying envelope function](https://discourse.processing.org/t/loop-bug-in-applying-envelope-function/10077)

<div class="topic-metadata">

**Author:** [@l3ehfar](https://discourse.processing.org/u/l3ehfar)\
**Replies:** 2\
**Last updated:** [April 8, 2019, 1:28pm UTC](https://discourse.processing.org/t/loop-bug-in-applying-envelope-function/10077 "2019-04-08T13:28:23Z")

</div>

I’m trying to add an envelope to my samples but it seems according to loop function(I guess) for playing any of sample the previous samples play too. var song=\[\]; var doorbell=\[\]; var amp; var playBackRate; var time=0; …

---

## [Looking for Assistance or direction for dynamic glitter effect with blurr fading](https://discourse.processing.org/t/looking-for-assistance-or-direction-for-dynamic-glitter-effect-with-blurr-fading/9258)

<div class="topic-metadata">

**Author:** [@digimbyte](https://discourse.processing.org/u/digimbyte)\
**Replies:** 6\
**Last updated:** [April 8, 2019, 1:13am UTC](https://discourse.processing.org/t/looking-for-assistance-or-direction-for-dynamic-glitter-effect-with-blurr-fading/9258 "2019-04-08T01:13:40Z")

</div>

Hello, I am new to the world of canvas and I am looking for something quick, simple, and optimized for a clients website. the website has an SVG stencil of the logo and it needs particle effects on it, I’m familiar enou…

---

## [Series of latitude and longitude points to a 2D polygon](https://discourse.processing.org/t/series-of-latitude-and-longitude-points-to-a-2d-polygon/9900)

<div class="topic-metadata">

**Author:** [@kkisin](https://discourse.processing.org/u/kkisin)\
**Replies:** 4\
**Last updated:** [April 7, 2019, 8:24pm UTC](https://discourse.processing.org/t/series-of-latitude-and-longitude-points-to-a-2d-polygon/9900 "2019-04-07T20:24:39Z")

</div>

Hello! I’m trying to convert a series of latitude and longitude points to show up as a polygon at scale in p5.js for example starting with the following series of lat/lon points 44.964782, -93.276922 44.964125, -93.26…

---

## [Applying envelope functions to a soundfile](https://discourse.processing.org/t/applying-envelope-functions-to-a-soundfile/10047)

<div class="topic-metadata">

**Author:** [@l3ehfar](https://discourse.processing.org/u/l3ehfar)\
**Replies:** 1\
**Last updated:** [April 7, 2019, 1:08pm UTC](https://discourse.processing.org/t/applying-envelope-functions-to-a-soundfile/10047 "2019-04-07T13:08:13Z")

</div>

due to my understanding of p5js.org examples, applying envelope is just acceptable to an oscillator or a wave which has been made by p5js synthesizer itself, is it any possibility to apply an envelope function to a sound…

---

## [Centre sketch on specific X and Y co-ordinates](https://discourse.processing.org/t/centre-sketch-on-specific-x-and-y-co-ordinates/9977)

<div class="topic-metadata">

**Author:** [@echo\_bravo](https://discourse.processing.org/u/echo_bravo)\
**Replies:** 2\
**Last updated:** [April 6, 2019, 7:26pm UTC](https://discourse.processing.org/t/centre-sketch-on-specific-x-and-y-co-ordinates/9977 "2019-04-06T19:26:02Z")

</div>

Hi, This is my first forum post/request so please forgive me if I miss any of the etiquette. I have used various various previous version of Java processing but am new to p5.js. What I am struggling with is how to cent…

---

## [Unwanted beeping sounds with Vertex functions](https://discourse.processing.org/t/unwanted-beeping-sounds-with-vertex-functions/9985)

<div class="topic-metadata">

**Author:** [@JusaStronomer](https://discourse.processing.org/u/JusaStronomer)\
**Replies:** 3\
**Last updated:** [April 6, 2019, 7:08pm UTC](https://discourse.processing.org/t/unwanted-beeping-sounds-with-vertex-functions/9985 "2019-04-06T19:08:57Z")

</div>

While using the beginShape(), endShape() and vertex() functions, I noticed some undesired beeping sounds (followed by low pitch “drumming” sounds). I tried searching for discussions over this topic, but couldn’t find it …

---

## [Switch Between Multiple p5.js Sketches in Single Webpage](https://discourse.processing.org/t/switch-between-multiple-p5-js-sketches-in-single-webpage/9981)

<div class="topic-metadata">

**Author:** [@CalebMarcoux](https://discourse.processing.org/u/CalebMarcoux)\
**Replies:** 4\
**Last updated:** [April 6, 2019, 12:23am UTC](https://discourse.processing.org/t/switch-between-multiple-p5-js-sketches-in-single-webpage/9981 "2019-04-06T00:23:52Z")

</div>

TLDR: Is it better to have lots of instances of p5.js or keep switching the code in the global mode? Is there a way to treat a JS file as a single instance of p5.js without modifying the code inside the file? I have sev…

---

## [Help with making code more effective and efficient](https://discourse.processing.org/t/help-with-making-code-more-effective-and-efficient/9924)

<div class="topic-metadata">

**Author:** [@peachman](https://discourse.processing.org/u/peachman)\
**Replies:** 3\
**Last updated:** [April 5, 2019, 11:05pm UTC](https://discourse.processing.org/t/help-with-making-code-more-effective-and-efficient/9924 "2019-04-05T23:05:41Z")

</div>

Hi All, First time poster, apologises in advance for bad formatting, I have only been using P5.js for about 2 weeks now. I have had previous knowledge of how code works from my programming course at college. 5 years on …

---

## [Creating a game in P5JS](https://discourse.processing.org/t/creating-a-game-in-p5js/9885)

<div class="topic-metadata">

**Author:** [@Ziomix](https://discourse.processing.org/u/Ziomix)\
**Replies:** 2\
**Last updated:** [April 3, 2019, 10:31pm UTC](https://discourse.processing.org/t/creating-a-game-in-p5js/9885 "2019-04-03T22:31:15Z")

</div>

Good morning, everyone, I would like to have some help in my project. My project is as follows: Create a game in P5JS ( of your choice). I already have the basis of the script and I know what I want to do next but unfo…

---

## [(web p5.js) 2048 - Lots of Undefined errors when I do remove(array, index)](https://discourse.processing.org/t/web-p5-js-2048-lots-of-undefined-errors-when-i-do-remove-array-index/9899)

<div class="topic-metadata">

**Author:** [@ILikePi](https://discourse.processing.org/u/ILikePi)\
**Replies:** 5\
**Last updated:** [April 3, 2019, 7:22pm UTC](https://discourse.processing.org/t/web-p5-js-2048-lots-of-undefined-errors-when-i-do-remove-array-index/9899 "2019-04-03T19:22:18Z")

</div>

This is the game of 2048, I am attempting to recreate it to practice using p5. The code is probably very messy, sorry in advance. The First Error I get is " remove is not defined " The Second Error I get is " fill is n…

---

## [Get returning incorrect pixel color](https://discourse.processing.org/t/get-returning-incorrect-pixel-color/9826)

<div class="topic-metadata">

**Author:** [@Nokuro](https://discourse.processing.org/u/Nokuro)\
**Replies:** 7\
**Last updated:** [April 3, 2019, 12:12pm UTC](https://discourse.processing.org/t/get-returning-incorrect-pixel-color/9826 "2019-04-03T12:12:49Z")

</div>

get returning incorrect pixel color. See the image, There is a big green rectangle behind those circles. when I use get(x,y) in one of those circles, in the picture you can see the black dot, it is the location wher…

---

## [Snake: Will not ad cells to array with push. Why not?](https://discourse.processing.org/t/snake-will-not-ad-cells-to-array-with-push-why-not/9890)

<div class="topic-metadata">

**Author:** [@steinlav](https://discourse.processing.org/u/steinlav)\
**Replies:** 3\
**Last updated:** [April 3, 2019, 5:42am UTC](https://discourse.processing.org/t/snake-will-not-ad-cells-to-array-with-push-why-not/9890 "2019-04-03T05:42:28Z")

</div>

I am translating from Processing: http://vestera.as/processing/?id=23 to p5.js: https://editor.p5js.org/steinlav/sketches/1rkgu\_AGI Problem in p5.js line 57 Why is it not possible to ad object “head” to the array “b…

---

## [A p5js mode problem?](https://discourse.processing.org/t/a-p5js-mode-problem/9861)

<div class="topic-metadata">

**Author:** [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)\
**Replies:** 9\
**Last updated:** [April 2, 2019, 7:37pm UTC](https://discourse.processing.org/t/a-p5js-mode-problem/9861 "2019-04-02T19:37:55Z")

</div>

Hello, I tried a very P5JS simple sketch and it doesn’t work in the with P5JS mode. It works fine in P5JS webeditor. I’ve got : Syntax Error : “Expected an operand but found class” The code is "use strict"; let bu…

---

## [First time working with beginShape and endShape](https://discourse.processing.org/t/first-time-working-with-beginshape-and-endshape/9810)

<div class="topic-metadata">

**Author:** [@ZachMcMkay](https://discourse.processing.org/u/ZachMcMkay)\
**Replies:** 1\
**Last updated:** [April 2, 2019, 1:23am UTC](https://discourse.processing.org/t/first-time-working-with-beginshape-and-endshape/9810 "2019-04-02T01:23:12Z")

</div>

So basically this is code for a project. I have the circles rotating how I’d like them to, I also have a point on the inner circle rotating how i’d like it to. The point’s x and y positions are being saved in an array …

---

## [How to check if 4 lines make a rectangle?](https://discourse.processing.org/t/how-to-check-if-4-lines-make-a-rectangle/9639)

<div class="topic-metadata">

**Author:** [@misho\_0501](https://discourse.processing.org/u/misho_0501)\
**Replies:** 6\
**Last updated:** [April 1, 2019, 7:33pm UTC](https://discourse.processing.org/t/how-to-check-if-4-lines-make-a-rectangle/9639 "2019-04-01T19:33:04Z")

</div>

I’ve been tring to make the game Connect the dots and now I have a question. What is the easiest or the right way to check when four dots are connected and are making a rectangle. Here is a link to my implementation so …

---

## [Make different objects appear at different timing](https://discourse.processing.org/t/make-different-objects-appear-at-different-timing/9806)

<div class="topic-metadata">

**Author:** [@blkpanther](https://discourse.processing.org/u/blkpanther)\
**Replies:** 6\
**Last updated:** [April 1, 2019, 1:58am UTC](https://discourse.processing.org/t/make-different-objects-appear-at-different-timing/9806 "2019-04-01T01:58:27Z")

</div>

Hi, I have a code where I intend circles to appear on the canvas at different timing, then enlarge and disappear. Despite my attempts, they all seem to appear simultaneously. Anything wrong with setTimeout here? Thanks. …

---

## [My First Feedback (and a suggestion for a standard function for p5.js)](https://discourse.processing.org/t/my-first-feedback-and-a-suggestion-for-a-standard-function-for-p5-js/9798)

<div class="topic-metadata">

**Author:** [@NeilTheSeal](https://discourse.processing.org/u/NeilTheSeal)\
**Replies:** 4\
**Last updated:** [April 1, 2019, 2:19am UTC](https://discourse.processing.org/t/my-first-feedback-and-a-suggestion-for-a-standard-function-for-p5-js/9798 "2019-04-01T02:19:59Z")

</div>

Hi to the community, I have begun making p5.js sketches recently to help instruct math and science at my university, and it’s perfect for our applications. So first of all, thanks to all the contributors and our friends …

---

## [Using p5 without sketch.js, setup() and draw()](https://discourse.processing.org/t/using-p5-without-sketch-js-setup-and-draw/9766)

<div class="topic-metadata">

**Author:** [@Milky](https://discourse.processing.org/u/Milky)\
**Replies:** 3\
**Last updated:** [March 31, 2019, 5:09pm UTC](https://discourse.processing.org/t/using-p5-without-sketch-js-setup-and-draw/9766 "2019-03-31T17:09:35Z")

</div>

Hello again, So, I want to add a new JS file to my project that I would like to run instead of the sketch.js file as the “main” JS file. Not always but sometimes. This is because I would like to separate my games “core”…

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

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