# p5.js

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

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

**Page:** 113

---

## [Drag and drop local files into p5 skecthes](https://discourse.processing.org/t/drag-and-drop-local-files-into-p5-skecthes/1144)

<div class="topic-metadata">

**Author:** [@colin](https://discourse.processing.org/u/colin)\
**Replies:** 9\
**Last updated:** [June 22, 2018, 8:48am UTC](https://discourse.processing.org/t/drag-and-drop-local-files-into-p5-skecthes/1144 "2018-06-22T08:48:34Z")

</div>

Hi, I have a quick question. I would allow my sketch’s users to drag and drop an image file into the program window, and then use it. I can’t find any function for that in p5.js. What would be the easiest way to do that…

---

## [Iframes + multiple sketches + webstorage api](https://discourse.processing.org/t/iframes-multiple-sketches-webstorage-api/784)

<div class="topic-metadata">

**Author:** [@Mark](https://discourse.processing.org/u/Mark)\
**Replies:** 4\
**Last updated:** [June 22, 2018, 4:17am UTC](https://discourse.processing.org/t/iframes-multiple-sketches-webstorage-api/784 "2018-06-22T04:17:35Z")

</div>

I’m designing a psychology experiment that uses two very different sketches. I only want one to be seen at a time. Sketch #1 implements a sequencer using the p5.sound library, a single button, and a slider Sketch #2 di…

---

## [Analysing image file make my browser stop working](https://discourse.processing.org/t/analysing-image-file-make-my-browser-stop-working/893)

<div class="topic-metadata">

**Author:** [@colin](https://discourse.processing.org/u/colin)\
**Replies:** 3\
**Last updated:** [June 21, 2018, 5:40am UTC](https://discourse.processing.org/t/analysing-image-file-make-my-browser-stop-working/893 "2018-06-21T05:40:03Z")

</div>

Hi, I’m making a sketch that load an image, rotate it a bit and display it. The program works well on my code editor, but it is not working on my browser. I first though there were some infinite loop, but after few res…

---

## [P5 value changed bug](https://discourse.processing.org/t/p5-value-changed-bug/1056)

<div class="topic-metadata">

**Author:** [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Replies:** 14\
**Last updated:** [June 21, 2018, 3:51am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056 "2018-06-21T03:51:21Z")

</div>

Every time i used p5.js, it says “You just changed the value of “something”, which was a p5 function. This could cause problems later if you’re not careful.”. It still works, but when i created a canvas, it showed 2 and …

---

## [Program crashes?](https://discourse.processing.org/t/program-crashes/1140)

<div class="topic-metadata">

**Author:** [@Grimtin10](https://discourse.processing.org/u/Grimtin10)\
**Replies:** 4\
**Last updated:** [June 21, 2018, 3:32am UTC](https://discourse.processing.org/t/program-crashes/1140 "2018-06-21T03:32:43Z")

</div>

Why does this program freeze? https://pastebin.com/VwKiqanB Please help! I’ve been trying to fix it, but no avail. -Grim

---

## [How to increase the masterVolume past 1?](https://discourse.processing.org/t/how-to-increase-the-mastervolume-past-1/1095)

<div class="topic-metadata">

**Author:** [@repgainer3](https://discourse.processing.org/u/repgainer3)\
**Replies:** 2\
**Last updated:** [June 21, 2018, 12:34am UTC](https://discourse.processing.org/t/how-to-increase-the-mastervolume-past-1/1095 "2018-06-21T00:34:51Z")

</div>

Hey, I’m trying to use p5.sound to make a web application that blasts text to speech (with p5.speech) onto my computer, I’ve tried “masterVolume(10000)”, and “myVoice.setVolume(10000)”. But they all cap at 1, is it possi…

---

## [P5js (function) is not defined](https://discourse.processing.org/t/p5js-function-is-not-defined/1114)

<div class="topic-metadata">

**Author:** [@Grimtin10](https://discourse.processing.org/u/Grimtin10)\
**Replies:** 9\
**Last updated:** [June 20, 2018, 8:51am UTC](https://discourse.processing.org/t/p5js-function-is-not-defined/1114 "2018-06-20T08:51:07Z")

</div>

I’m having problems with this, and I don’t know what it means. Any help? -Grim

---

## [WEBGL Help - Experiencing pointLight() issues](https://discourse.processing.org/t/webgl-help-experiencing-pointlight-issues/995)

<div class="topic-metadata">

**Author:** [@okliis](https://discourse.processing.org/u/okliis)\
**Replies:** 7\
**Last updated:** [June 19, 2018, 10:42pm UTC](https://discourse.processing.org/t/webgl-help-experiencing-pointlight-issues/995 "2018-06-19T22:42:13Z")

</div>

Hi all. Having problems with pointLight(). The light source on my canvas seems weak compared to the tutorial I am following. The tutorial (Coding Train) browser renders this, while my browser (Chrome 67) renders this: …

---

## [Performance issue: p5.js crushing my CPU (possible retina issue?)](https://discourse.processing.org/t/performance-issue-p5-js-crushing-my-cpu-possible-retina-issue/999)

<div class="topic-metadata">

**Author:** [@matthewjohnjamieson](https://discourse.processing.org/u/matthewjohnjamieson)\
**Replies:** 12\
**Last updated:** [June 19, 2018, 9:25pm UTC](https://discourse.processing.org/t/performance-issue-p5-js-crushing-my-cpu-possible-retina-issue/999 "2018-06-19T21:25:44Z")

</div>

Hi there. I’ve been working with p5.js for about 6 months now, and have had an ongoing performance issue even for simple sketches. I’ve been testing it on and off to see how to get to the bottom of it. I have a test sket…

---

## [Making an interactive Form Inputs on P5.js](https://discourse.processing.org/t/making-an-interactive-form-inputs-on-p5-js/1082)

<div class="topic-metadata">

**Author:** [@Abbeysoft](https://discourse.processing.org/u/Abbeysoft)\
**Replies:** 3\
**Last updated:** [June 19, 2018, 6:39pm UTC](https://discourse.processing.org/t/making-an-interactive-form-inputs-on-p5-js/1082 "2018-06-19T18:39:00Z")

</div>

Trust you are doing great! I am an avid user of this javascript library of P5.js Just to know if, how to create an interactive form inputs to generate objects (Circle, Rectangle, Lines) on a canvas, via the user’s form…

---

## [directionaLight() doesn't have any effect on my p5.js skecth](https://discourse.processing.org/t/directionalight-doesnt-have-any-effect-on-my-p5-js-skecth/1059)

<div class="topic-metadata">

**Author:** [@colin](https://discourse.processing.org/u/colin)\
**Replies:** 3\
**Last updated:** [June 18, 2018, 8:21pm UTC](https://discourse.processing.org/t/directionalight-doesnt-have-any-effect-on-my-p5-js-skecth/1059 "2018-06-18T20:21:06Z")

</div>

Hi everyone. I’m working on a 3D maze game in p5.js. Everything is working well so far, except the lights, and I can’t figure why :confused: For some reason I am unable to use directionalLight() or pointLight(), only …

---

## [Why does no exists method in p5.js?](https://discourse.processing.org/t/why-does-no-exists-method-in-p5-js/1013)

<div class="topic-metadata">

**Author:** [@erkosone](https://discourse.processing.org/u/erkosone)\
**Replies:** 7\
**Last updated:** [June 17, 2018, 11:05am UTC](https://discourse.processing.org/t/why-does-no-exists-method-in-p5-js/1013 "2018-06-17T11:05:24Z")

</div>

Why does not the method () function exist in p5.js? It is simple to implement. p5.js will be expanded with more functions as it has processing in java mode? Where can I find out about the development status of p5.js? ex…

---

## [Cannot read property 'bind' of null When using OpenProcessing](https://discourse.processing.org/t/cannot-read-property-bind-of-null-when-using-openprocessing/923)

<div class="topic-metadata">

**Author:** [@esulu](https://discourse.processing.org/u/esulu)\
**Replies:** 9\
**Last updated:** [June 17, 2018, 2:34am UTC](https://discourse.processing.org/t/cannot-read-property-bind-of-null-when-using-openprocessing/923 "2018-06-17T02:34:17Z")

</div>

Hello there. I am making a game in processing and it works fine, but I am trying to upload it to openprocessing.org but I’m running into some issues. I pasted my code on a new sketch and uploaded all of the files onto t…

---

## [The Perspective Calculation](https://discourse.processing.org/t/the-perspective-calculation/988)

<div class="topic-metadata">

**Author:** [@phoebus](https://discourse.processing.org/u/phoebus)\
**Replies:** 3\
**Last updated:** [June 16, 2018, 9:51am UTC](https://discourse.processing.org/t/the-perspective-calculation/988 "2018-06-16T09:51:47Z")

</div>

Hi there I’m trying to calculate the location of a 3D vertex in a 2D viewing window. According to this page it should be as simple as x' = (x\*near)/z y' = (y\*near)/z but I cannot find some sort of stable ground in t…

---

## [Midi and audio latency in p5.sound](https://discourse.processing.org/t/midi-and-audio-latency-in-p5-sound/1010)

<div class="topic-metadata">

**Author:** [@jjd](https://discourse.processing.org/u/jjd)\
**Replies:** 0\
**Last updated:** [June 16, 2018, 10:10am UTC](https://discourse.processing.org/t/midi-and-audio-latency-in-p5-sound/1010 "2018-06-16T10:10:50Z")

</div>

Hi, I’ve been playing around with the Web MIDI API for Chrome and wanted to see if I could make a web based synth. So I’ve just downloaded the p5 libraries and much to my surprise, it only took me a few minutes to set up…

---

## [Why does my p5js game not work for iPhones?](https://discourse.processing.org/t/why-does-my-p5js-game-not-work-for-iphones/891)

<div class="topic-metadata">

**Author:** [@helloDolly](https://discourse.processing.org/u/helloDolly)\
**Replies:** 8\
**Last updated:** [June 16, 2018, 7:42am UTC](https://discourse.processing.org/t/why-does-my-p5js-game-not-work-for-iphones/891 "2018-06-16T07:42:27Z")

</div>

I made a little game in p5js and can’t figure out why it won’t work for iPhones. For all I know p5js doesn’t work at all with iPhones though so if that’s the case let me know. The game seems to work fine on PC’s and Andr…

---

## [TypeScript: p5/lib/addons/p5.dom not found on request](https://discourse.processing.org/t/typescript-p5-lib-addons-p5-dom-not-found-on-request/765)

<div class="topic-metadata">

**Author:** [@mictadlo](https://discourse.processing.org/u/mictadlo)\
**Replies:** 1\
**Last updated:** [June 14, 2018, 9:50pm UTC](https://discourse.processing.org/t/typescript-p5-lib-addons-p5-dom-not-found-on-request/765 "2018-06-14T21:50:26Z")

</div>

Hi, I rewrote a JS code to TypeScript but I got p5/lib/addons/p5.dom not found on request. This is the code: src/sketch.ts // https://vimeo.com/channels/learningp5js/142698162 import 'p5'; require('p5/lib/addons/p5.d…

---

## [Http authentication](https://discourse.processing.org/t/http-authentication/828)

<div class="topic-metadata">

**Author:** [@stanleyseow](https://discourse.processing.org/u/stanleyseow)\
**Replies:** 4\
**Last updated:** [June 12, 2018, 9:25am UTC](https://discourse.processing.org/t/http-authentication/828 "2018-06-12T09:25:12Z")

</div>

I tried to use the httpDo() with the following code for basic authentication but it is not working, can someone advise on this ? I got a “Failed to load resource: the server responded with a status of 401 (Unauthorized)…

---

## [Processing for windows in P5 mode there is no debug options](https://discourse.processing.org/t/processing-for-windows-in-p5-mode-there-is-no-debug-options/820)

<div class="topic-metadata">

**Author:** [@Serge](https://discourse.processing.org/u/Serge)\
**Replies:** 2\
**Last updated:** [June 11, 2018, 4:48pm UTC](https://discourse.processing.org/t/processing-for-windows-in-p5-mode-there-is-no-debug-options/820 "2018-06-11T16:48:40Z")

</div>

Is there a library or something to get the debug option in P5 processing editor

---

## [Arduino LED Hello World](https://discourse.processing.org/t/arduino-led-hello-world/819)

<div class="topic-metadata">

**Author:** [@Onsgaannoubraai](https://discourse.processing.org/u/Onsgaannoubraai)\
**Replies:** 0\
**Last updated:** [June 9, 2018, 10:01pm UTC](https://discourse.processing.org/t/arduino-led-hello-world/819 "2018-06-09T22:01:22Z")

</div>

Beginner to P5js and Arduinos. Trying to setup a LED on the Arduino (windows machine + dont have a rgb LED) to blink on arrow key press for the Hello World setup. Using the example files I have commented in the LED on …

---

## [Num undefined, no messages](https://discourse.processing.org/t/num-undefined-no-messages/813)

<div class="topic-metadata">

**Author:** [@Serge](https://discourse.processing.org/u/Serge)\
**Replies:** 6\
**Last updated:** [June 9, 2018, 9:49pm UTC](https://discourse.processing.org/t/num-undefined-no-messages/813 "2018-06-09T21:49:17Z")

</div>

https://p5js.org/examples/structure-functions.html in this example num is use but is not defined What is this num variable? argument not defined? else? Here is the code: function setup() { createCanvas(720, 400); …

---

## [Trying to load an array from a JSON](https://discourse.processing.org/t/trying-to-load-an-array-from-a-json/685)

<div class="topic-metadata">

**Author:** [@Red\_Hen](https://discourse.processing.org/u/Red_Hen)\
**Replies:** 3\
**Last updated:** [June 9, 2018, 10:21am UTC](https://discourse.processing.org/t/trying-to-load-an-array-from-a-json/685 "2018-06-09T10:21:36Z")

</div>

Hello! So, I’m trying to get data from a JSON file, where the data was saved as an array. But when I try to retrieve discrete values, they come back as ‘undefined’. Can you help? What am I doing wrong? let locJ = 'des…

---

## [Animation not visible after converting code to typescript](https://discourse.processing.org/t/animation-not-visible-after-converting-code-to-typescript/693)

<div class="topic-metadata">

**Author:** [@mictadlo](https://discourse.processing.org/u/mictadlo)\
**Replies:** 9\
**Last updated:** [June 7, 2018, 4:02am UTC](https://discourse.processing.org/t/animation-not-visible-after-converting-code-to-typescript/693 "2018-06-07T04:02:57Z")

</div>

Hello, I took an example from codingtrain and rewrote it to typescritpt. Unfortunately, it does not show any animation in the browser. Here is the code: src/sketch.ts: import 'p5'; import { Bubble } from "./Bubble"; …

---

## [Bullet Array not responding](https://discourse.processing.org/t/bullet-array-not-responding/754)

<div class="topic-metadata">

**Author:** [@Carson147](https://discourse.processing.org/u/Carson147)\
**Replies:** 2\
**Last updated:** [June 6, 2018, 7:41pm UTC](https://discourse.processing.org/t/bullet-array-not-responding/754 "2018-06-06T19:41:41Z")

</div>

I created a bullet function in this mini game where an ellipse will spawn on where the player is and move to the right. I then created a console.log command for when the ellipse goes off screen. But nothing seems to happ…

---

## [createCapture(VIDEO) way to select webcam?](https://discourse.processing.org/t/createcapture-video-way-to-select-webcam/738)

<div class="topic-metadata">

**Author:** [@AndrewCraigie](https://discourse.processing.org/u/AndrewCraigie)\
**Replies:** 1\
**Last updated:** [June 5, 2018, 10:24pm UTC](https://discourse.processing.org/t/createcapture-video-way-to-select-webcam/738 "2018-06-05T22:24:40Z")

</div>

Is there a way to select which webcam to capture video from when a computer has more than one video source available? I’ve looked in the source code but there doesn’t seem to be any way to list available webcams or indic…

---

## [How can I make a sprite (or image) unable to pass through lines?](https://discourse.processing.org/t/how-can-i-make-a-sprite-or-image-unable-to-pass-through-lines/675)

<div class="topic-metadata">

**Author:** [@rimai](https://discourse.processing.org/u/rimai)\
**Replies:** 4\
**Last updated:** [June 4, 2018, 4:33am UTC](https://discourse.processing.org/t/how-can-i-make-a-sprite-or-image-unable-to-pass-through-lines/675 "2018-06-04T04:33:29Z")

</div>

So I’ve imported a maze image (png) as the background of my canvas, and drawn lines over the corresponding lines in the image in p5. I’ve created a sprite which is my ‘character’ and it’s just a small image, and all it’s…

---

## [Trying to make an image disappear after clicking it p5](https://discourse.processing.org/t/trying-to-make-an-image-disappear-after-clicking-it-p5/627)

<div class="topic-metadata">

**Author:** [@rimai](https://discourse.processing.org/u/rimai)\
**Replies:** 7\
**Last updated:** [June 3, 2018, 1:51pm UTC](https://discourse.processing.org/t/trying-to-make-an-image-disappear-after-clicking-it-p5/627 "2018-06-03T13:51:20Z")

</div>

So I have very beginner knowledge with code, and am trying to make a ‘forest’ scene where the user can click on 5 little blobs of slime mould, and once they click on them they disappear. Right now the 5 blobs of slime m…

---

## [Alternative of Network library for P5.js](https://discourse.processing.org/t/alternative-of-network-library-for-p5-js/595)

<div class="topic-metadata">

**Author:** [@totovr76](https://discourse.processing.org/u/totovr76)\
**Replies:** 1\
**Last updated:** [June 1, 2018, 11:56am UTC](https://discourse.processing.org/t/alternative-of-network-library-for-p5-js/595 "2018-06-01T11:56:51Z")

</div>

Hello! I’m writing an sketch in Processing using Network library, I would like to know if exist any alternative of this library using p5.js to display the data acquired by a server.

---

## [Controlling CSS values with mouse in p5.js](https://discourse.processing.org/t/controlling-css-values-with-mouse-in-p5-js/156)

<div class="topic-metadata">

**Author:** [@AndreasRef](https://discourse.processing.org/u/AndreasRef)\
**Replies:** 7\
**Last updated:** [May 31, 2018, 7:50pm UTC](https://discourse.processing.org/t/controlling-css-values-with-mouse-in-p5-js/156 "2018-05-31T19:50:08Z")

</div>

Hi I have a question about controlling css values with p5.js - for instance setting them according to some interactive input like mouse position. If I have a (variable) font with css settings I can set using css like …

---

## [Include p5.js in Observable notebook](https://discourse.processing.org/t/include-p5-js-in-observable-notebook/458)

<div class="topic-metadata">

**Author:** [@mainul12](https://discourse.processing.org/u/mainul12)\
**Replies:** 7\
**Last updated:** [May 30, 2018, 3:52am UTC](https://discourse.processing.org/t/include-p5-js-in-observable-notebook/458 "2018-05-30T03:52:47Z")

</div>

I have recently come across Observable notebooks and I would like to know how to include the p5.js library in the notebook. I have tried the following but it throws a syntax error. p5 = require(“https://cdnjs.cloudflar…

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

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