# p5.js

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

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

**Page:** 67

---

## [Browser Autoplay/CORS policy is making my P5 web game not work](https://discourse.processing.org/t/browser-autoplay-cors-policy-is-making-my-p5-web-game-not-work/22117)

<div class="topic-metadata">

**Author:** [@Sudb](https://discourse.processing.org/u/Sudb)\
**Replies:** 5\
**Last updated:** [June 29, 2020, 6:47pm UTC](https://discourse.processing.org/t/browser-autoplay-cors-policy-is-making-my-p5-web-game-not-work/22117 "2020-06-29T18:47:46Z")

</div>

Hello. I made the game in this url: http://bunnypop.bizsb.com/ as part of a class project last year. The game has worked fine until recently. It has suddenly stopped working and I suspect it is because of browser Autopla…

---

## [Conceptual Clarity on frameCount and rotate function](https://discourse.processing.org/t/conceptual-clarity-on-framecount-and-rotate-function/22246)

<div class="topic-metadata">

**Author:** [@diomedeidae](https://discourse.processing.org/u/diomedeidae)\
**Replies:** 3\
**Last updated:** [June 29, 2020, 2:00pm UTC](https://discourse.processing.org/t/conceptual-clarity-on-framecount-and-rotate-function/22246 "2020-06-29T14:00:44Z")

</div>

I was doing one of the examples on the p5.js website - https://p5js.org/examples/form-regular-polygon.html. I got really confused by the way rotate function worked in that code . IN the below function if I just pass rota…

---

## [Can't get scene manager to work](https://discourse.processing.org/t/cant-get-scene-manager-to-work/22195)

<div class="topic-metadata">

**Author:** [@olorin](https://discourse.processing.org/u/olorin)\
**Replies:** 2\
**Last updated:** [June 28, 2020, 9:02pm UTC](https://discourse.processing.org/t/cant-get-scene-manager-to-work/22195 "2020-06-28T21:02:25Z")

</div>

I cant seem to get this sketch to display anything. when I remove the this.setup and this.draw functions an image appears but i need it to loop as it does in draw. I’m using scene manager var pages; let gui; let afterFi…

---

## [Making object appear in random locations](https://discourse.processing.org/t/making-object-appear-in-random-locations/22216)

<div class="topic-metadata">

**Author:** [@liekevoortman](https://discourse.processing.org/u/liekevoortman)\
**Replies:** 5\
**Last updated:** [June 28, 2020, 1:24pm UTC](https://discourse.processing.org/t/making-object-appear-in-random-locations/22216 "2020-06-28T13:24:34Z")

</div>

Hi! I need to make an object (circle) appear in random locations on my screen. So it appears, dissapears, and appears again in another random location, and so forth. Maybe this is really simple, but I’m not very familiar…

---

## [Create Website like chordfy.net](https://discourse.processing.org/t/create-website-like-chordfy-net/22172)

<div class="topic-metadata">

**Author:** [@arianaiwan](https://discourse.processing.org/u/arianaiwan)\
**Replies:** 1\
**Last updated:** [June 27, 2020, 10:31pm UTC](https://discourse.processing.org/t/create-website-like-chordfy-net/22172 "2020-06-27T22:31:40Z")

</div>

I want to make a website that can detect chords or tones in a song. for example like the website https://chordify.net/ is it possible with this p5js. please explain because I’m just a beginner.

---

## [How can i optimize this chain of if/else statement?](https://discourse.processing.org/t/how-can-i-optimize-this-chain-of-if-else-statement/22182)

<div class="topic-metadata">

**Author:** [@bismarck](https://discourse.processing.org/u/bismarck)\
**Replies:** 3\
**Last updated:** [June 27, 2020, 9:07pm UTC](https://discourse.processing.org/t/how-can-i-optimize-this-chain-of-if-else-statement/22182 "2020-06-27T21:07:02Z")

</div>

hello i want to optimize this code. I thought that i can use the switch statement, but i don’t know how to implement it: //function setup() { createCanvas(400, 400); } function draw() { background(220); let s…

---

## [An Innovative Problem's Solution - app prototype in P5](https://discourse.processing.org/t/an-innovative-problems-solution-app-prototype-in-p5/22181)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 2\
**Last updated:** [June 27, 2020, 2:53pm UTC](https://discourse.processing.org/t/an-innovative-problems-solution-app-prototype-in-p5/22181 "2020-06-27T14:53:59Z")

</div>

I’ve been enrolled in a challenge where I’ve to make an app which solves a problem (I think the problem itself should be innovative)… Got many points: An app which tells only about the truth of an action made by the g…

---

## [How to add a canvas to a \<div\> and center it?](https://discourse.processing.org/t/how-to-add-a-canvas-to-a-div-and-center-it/22107)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 4\
**Last updated:** [June 26, 2020, 6:48am UTC](https://discourse.processing.org/t/how-to-add-a-canvas-to-a-div-and-center-it/22107 "2020-06-26T06:48:31Z")

</div>

I’m not sure if div is the best thing to use but here goes. I have 2 different types of canvases. Type 1 will be centered horizontally. Type 2 will be centered horizontally and vertically. I have 2 different snippets of…

---

## [Texture with P2D renderer?](https://discourse.processing.org/t/texture-with-p2d-renderer/22148)

<div class="topic-metadata">

**Author:** [@grege2](https://discourse.processing.org/u/grege2)\
**Replies:** 2\
**Last updated:** [June 25, 2020, 8:04pm UTC](https://discourse.processing.org/t/texture-with-p2d-renderer/22148 "2020-06-25T20:04:35Z")

</div>

Hi, Is it possible at all, maybe with a hack to directly talk to the browser GL rendering layer, to use simple texturing in the p5.js P2D renderer ? In Java Processing it seems it might be possible in the P2D renderer, …

---

## [Tilemap with Buildings and Mousemovement, does not work like it should](https://discourse.processing.org/t/tilemap-with-buildings-and-mousemovement-does-not-work-like-it-should/22159)

<div class="topic-metadata">

**Author:** [@rotzend](https://discourse.processing.org/u/rotzend)\
**Replies:** 1\
**Last updated:** [June 25, 2020, 6:00pm UTC](https://discourse.processing.org/t/tilemap-with-buildings-and-mousemovement-does-not-work-like-it-should/22159 "2020-06-25T18:00:30Z")

</div>

Hello everybody, I have only been dealing with canvas for a very short time, thanks to the YouTube “The Coding Train” I became aware of p5js years ago and I am really enthusiastic, it is significantly faster, smaller an…

---

## [Want a suggestion to make a tremendous problem-solver app but prototype of it in p5js](https://discourse.processing.org/t/want-a-suggestion-to-make-a-tremendous-problem-solver-app-but-prototype-of-it-in-p5js/22167)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 1\
**Last updated:** [June 25, 2020, 5:51pm UTC](https://discourse.processing.org/t/want-a-suggestion-to-make-a-tremendous-problem-solver-app-but-prototype-of-it-in-p5js/22167 "2020-06-25T17:51:10Z")

</div>

I’ve been enrolled in a challenge where I’ve to make an app which solves a problem (I think the problem itself should be innovative)… Got many points: An app which tells only about the truth of an action made by the g…

---

## [HttpDo return string?](https://discourse.processing.org/t/httpdo-return-string/22121)

<div class="topic-metadata">

**Author:** [@sasaKDH](https://discourse.processing.org/u/sasaKDH)\
**Replies:** 1\
**Last updated:** [June 24, 2020, 8:33pm UTC](https://discourse.processing.org/t/httpdo-return-string/22121 "2020-06-24T20:33:35Z")

</div>

function click6(){ if(dis==1){ username = input.value(); httpDo( userURL+username, { method: 'GET', // Other Request options, like special headers for apis headers: { Authori…

---

## [Buffered Draw to improve performance](https://discourse.processing.org/t/buffered-draw-to-improve-performance/21943)

<div class="topic-metadata">

**Author:** [@bruce](https://discourse.processing.org/u/bruce)\
**Replies:** 2\
**Last updated:** [June 24, 2020, 10:41am UTC](https://discourse.processing.org/t/buffered-draw-to-improve-performance/21943 "2020-06-24T10:41:28Z")

</div>

I notice that p5.js gets overloaded quickly when it gets a lot of work and screen updates to do on every draw cycle. My system temperature goes up and I hear the fan spinning at max speed. It happens a lot! So, I’m wo…

---

## [Smooth rendering of the line movement](https://discourse.processing.org/t/smooth-rendering-of-the-line-movement/22077)

<div class="topic-metadata">

**Author:** [@holyjc827](https://discourse.processing.org/u/holyjc827)\
**Replies:** 2\
**Last updated:** [June 23, 2020, 6:12am UTC](https://discourse.processing.org/t/smooth-rendering-of-the-line-movement/22077 "2020-06-23T06:12:24Z")

</div>

Hello, I have been trying to make each compass line rotate smoothly, as per noise function value. However, no matter what I try, it moves like a second hand of the clock, rather than a smooth movement of rotation. Could …

---

## [Error with p5.js web editor](https://discourse.processing.org/t/error-with-p5-js-web-editor/22047)

<div class="topic-metadata">

**Author:** [@Neonix](https://discourse.processing.org/u/Neonix)\
**Replies:** 4\
**Last updated:** [June 22, 2020, 2:22am UTC](https://discourse.processing.org/t/error-with-p5-js-web-editor/22047 "2020-06-22T02:22:28Z")

</div>

Hello everybody. I was just working on a sketch when, by accident, I pressed some keys in my keyboard (don’t know if this has to do with it but it happened immediately after so I think it does) and now every time I star…

---

## [Using mouse in p5 is a bit complicated](https://discourse.processing.org/t/using-mouse-in-p5-is-a-bit-complicated/21990)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 16\
**Last updated:** [June 20, 2020, 7:21pm UTC](https://discourse.processing.org/t/using-mouse-in-p5-is-a-bit-complicated/21990 "2020-06-20T19:21:49Z")

</div>

tell me of anything that I can use that is executed in only one frame when mouse is pressed within the if condition…

---

## [Can I load an image of a buffer and add it to a sprite](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 2\
**Last updated:** [June 20, 2020, 7:19pm UTC](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018 "2020-06-20T19:19:56Z")

</div>

I don’t know how to do it, the simple way is not working, is there any way to so it?? I am getting error like pathOfIndex is not defined on my loadImage line. Plz help me fast…

---

## [There's a bug in the createGraphics() part](https://discourse.processing.org/t/theres-a-bug-in-the-creategraphics-part/22019)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 2\
**Last updated:** [June 20, 2020, 7:18pm UTC](https://discourse.processing.org/t/theres-a-bug-in-the-creategraphics-part/22019 "2020-06-20T19:18:19Z")

</div>

I think I’ve found a bug in the buffer part. If you change the background of canvas, the buffer images don’t work…

---

## [P5.collide2d vector input feature discussion (please help us figure out the implementation of this new feature!)](https://discourse.processing.org/t/p5-collide2d-vector-input-feature-discussion-please-help-us-figure-out-the-implementation-of-this-new-feature/22028)

<div class="topic-metadata">

**Author:** [@bmoren](https://discourse.processing.org/u/bmoren)\
**Replies:** 0\
**Last updated:** [June 20, 2020, 3:49pm UTC](https://discourse.processing.org/t/p5-collide2d-vector-input-feature-discussion-please-help-us-figure-out-the-implementation-of-this-new-feature/22028 "2020-06-20T15:49:26Z")

</div>

Hi folks! We’re working on some updates to the p5.collide2d library to support vector inputs and I’d love to hear some other people’s thoughts on the best way to implement these new features. If you’re familiar with the …

---

## [Canvas not showing up at all](https://discourse.processing.org/t/canvas-not-showing-up-at-all/21800)

<div class="topic-metadata">

**Author:** [@KaiShaw91](https://discourse.processing.org/u/KaiShaw91)\
**Replies:** 10\
**Last updated:** [June 20, 2020, 12:47am UTC](https://discourse.processing.org/t/canvas-not-showing-up-at-all/21800 "2020-06-20T00:47:53Z")

</div>

i cant get the download version to work when i load the index.html i dont see the canvas at all setup{ createcanvas(400,400) } draw{ background(220); rect(5,5,40,30); } everything else is vanilla what it my problem Ed…

---

## [P5.js not found in parent directory](https://discourse.processing.org/t/p5-js-not-found-in-parent-directory/21981)

<div class="topic-metadata">

**Author:** [@astrogeek](https://discourse.processing.org/u/astrogeek)\
**Replies:** 9\
**Last updated:** [June 19, 2020, 11:16pm UTC](https://discourse.processing.org/t/p5-js-not-found-in-parent-directory/21981 "2020-06-19T23:16:01Z")

</div>

I’m just starting out with the p5js library, so this is a really basic question. I have downloaded the library file and unzipped it. I started messing around with the files in the “empty example” directory using Brackets…

---

## ["No response from server" error with sound files](https://discourse.processing.org/t/no-response-from-server-error-with-sound-files/20586)

<div class="topic-metadata">

**Author:** [@achandra](https://discourse.processing.org/u/achandra)\
**Replies:** 5\
**Last updated:** [June 19, 2020, 2:16pm UTC](https://discourse.processing.org/t/no-response-from-server-error-with-sound-files/20586 "2020-06-19T14:16:49Z")

</div>

Does anyone know what this error means? It happens on my code sometimes, I reload my sound files again and it becomes fine and then it happens after a while again.

---

## [Problems with desktop && mobile resizing](https://discourse.processing.org/t/problems-with-desktop-mobile-resizing/21894)

<div class="topic-metadata">

**Author:** [@akenaton](https://discourse.processing.org/u/akenaton)\
**Replies:** 13\
**Last updated:** [June 19, 2020, 1:50pm UTC](https://discourse.processing.org/t/problems-with-desktop-mobile-resizing/21894 "2020-06-19T13:50:01Z")

</div>

As i have to rewrite the index page from my site, i decided to use P5.js in order to learn somewhat about it. Coding was rather easy and my code works in P5.jsEditor. Now i am testing with real browsers and real phones a…

---

## ["No response from serve"r error with sound files](https://discourse.processing.org/t/no-response-from-serve-r-error-with-sound-files/21986)

<div class="topic-metadata">

**Author:** [@achandra](https://discourse.processing.org/u/achandra)\
**Replies:** 1\
**Last updated:** [June 19, 2020, 1:25pm UTC](https://discourse.processing.org/t/no-response-from-serve-r-error-with-sound-files/21986 "2020-06-19T13:25:41Z")

</div>

MY code has been giving this problem for a long time and I cant figure this out. It also doesn’t run on other people’s computers when I try and give them the link to my code. SOMETIMES it gives this error - There was n…

---

## [HOW TO USE createImage()?](https://discourse.processing.org/t/how-to-use-createimage/21885)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 15\
**Last updated:** [June 19, 2020, 8:55am UTC](https://discourse.processing.org/t/how-to-use-createimage/21885 "2020-06-19T08:55:56Z")

</div>

I have an idea where I want user to draw something and make it an image. How to use it, possibly, it has something to do with createImage(), but I’m not familiar with it. Thanks for helping me with it in advance

---

## [Import geometry and individual control](https://discourse.processing.org/t/import-geometry-and-individual-control/21988)

<div class="topic-metadata">

**Author:** [@TTG](https://discourse.processing.org/u/TTG)\
**Replies:** 0\
**Last updated:** [June 19, 2020, 7:52am UTC](https://discourse.processing.org/t/import-geometry-and-individual-control/21988 "2020-06-19T07:52:46Z")

</div>

Hi team, I am currently trying to find an elegant way in order to import geometry. P5 currently supports .obj ( loadModel) . The question is as follows: Can the loaded geometry be divided in individual parts? If th…

---

## [Adding event handlers to sketch](https://discourse.processing.org/t/adding-event-handlers-to-sketch/21863)

<div class="topic-metadata">

**Author:** [@Jithin](https://discourse.processing.org/u/Jithin)\
**Replies:** 3\
**Last updated:** [June 19, 2020, 8:06am UTC](https://discourse.processing.org/t/adding-event-handlers-to-sketch/21863 "2020-06-19T08:06:18Z")

</div>

Hi I’m trying to create a library that extends p5. I want to add event handlers to the sketch. I tried to use \_onmousedown event present in p5 prototype, but its giving me an errror. How can I achieve this? I could just…

---

## [No sound in Safari (find in chrome and firefox) - P5 Oscillator](https://discourse.processing.org/t/no-sound-in-safari-find-in-chrome-and-firefox-p5-oscillator/21969)

<div class="topic-metadata">

**Author:** [@bedlamagogo](https://discourse.processing.org/u/bedlamagogo)\
**Replies:** 4\
**Last updated:** [June 18, 2020, 8:31pm UTC](https://discourse.processing.org/t/no-sound-in-safari-find-in-chrome-and-firefox-p5-oscillator/21969 "2020-06-18T20:31:50Z")

</div>

Hi All, I have a project creating a synthesiser with a step sequencer which works perfectly in Chrome and Firefox - In Safari however there is no sound at all. All the functionality seems to be working just no sound… I …

---

## [Fading between shadertoy shaders in p5.js?](https://discourse.processing.org/t/fading-between-shadertoy-shaders-in-p5-js/21933)

<div class="topic-metadata">

**Author:** [@Spenc](https://discourse.processing.org/u/Spenc)\
**Replies:** 2\
**Last updated:** [June 18, 2020, 5:16pm UTC](https://discourse.processing.org/t/fading-between-shadertoy-shaders-in-p5-js/21933 "2020-06-18T17:16:50Z")

</div>

I am trying to fade between several different types of shaders from shadertoy by importing them to p5.js and am trying to figure out the best way to do that? I am trying to figure out if I can somehow just use the tint() …

---

## [Importing a list of image URLs with createinput() and/or csv file? 📦](https://discourse.processing.org/t/importing-a-list-of-image-urls-with-createinput-and-or-csv-file/21975)

<div class="topic-metadata">

**Author:** [@jwyg](https://discourse.processing.org/u/jwyg)\
**Replies:** 1\
**Last updated:** [June 18, 2020, 10:40am UTC](https://discourse.processing.org/t/importing-a-list-of-image-urls-with-createinput-and-or-csv-file/21975 "2020-06-18T10:40:17Z")

</div>

Hello everyone! :panda\_face: This is my first post on the p5.js forum. I’m excited to join this community and look forward to learning more about what you’re all doing and seeing how I am able to contribute. :turtle: I…

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

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