# p5.js

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

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

**Page:** 65

---

## [Converting Processing to Processing.js... please help?](https://discourse.processing.org/t/converting-processing-to-processing-js-please-help/22846)

<div class="topic-metadata">

**Author:** [@Quinny](https://discourse.processing.org/u/Quinny)\
**Replies:** 10\
**Last updated:** [July 26, 2020, 4:10pm UTC](https://discourse.processing.org/t/converting-processing-to-processing-js-please-help/22846 "2020-07-26T16:10:06Z")

</div>

Hello, I’m trying to convert a sketch made in Processing.js to standard Processing so I can port it as a canvass, using screen broadcast, onto surfaces in Unity. I’ve made all the obvious changes like var to int etc., …

---

## [P5.gui text area instead of text input](https://discourse.processing.org/t/p5-gui-text-area-instead-of-text-input/22848)

<div class="topic-metadata">

**Author:** [@hath](https://discourse.processing.org/u/hath)\
**Replies:** 0\
**Last updated:** [July 26, 2020, 4:08pm UTC](https://discourse.processing.org/t/p5-gui-text-area-instead-of-text-input/22848 "2020-07-26T16:08:35Z")

</div>

Is there a way to create a multi-line text area (as opposed to text input) using p5.gui? Assuming both quicksettings.js and p5.gui.js have been imported, the code below automatically generates a text input. I can’t seem…

---

## [My First Project - The "Frequency Spectrum" example](https://discourse.processing.org/t/my-first-project-the-frequency-spectrum-example/22842)

<div class="topic-metadata">

**Author:** [@basic](https://discourse.processing.org/u/basic)\
**Replies:** 2\
**Last updated:** [July 26, 2020, 3:38pm UTC](https://discourse.processing.org/t/my-first-project-the-frequency-spectrum-example/22842 "2020-07-26T15:38:00Z")

</div>

Hello All, I’m trying to create my first project, and so far failing miserably. As a self-taught programmer who learns by looking through other people’s code, I thought I’d start by getting one of the “example” project…

---

## [Canvas size / dimensions on save](https://discourse.processing.org/t/canvas-size-dimensions-on-save/22829)

<div class="topic-metadata">

**Author:** [@Honkitonkie](https://discourse.processing.org/u/Honkitonkie)\
**Replies:** 3\
**Last updated:** [July 25, 2020, 4:01pm UTC](https://discourse.processing.org/t/canvas-size-dimensions-on-save/22829 "2020-07-25T16:01:37Z")

</div>

Hello, When I create a canvas of 1200\*627 and save it (saveCanvas or manually) the dimensions change to 2400 \* 1254. I believe this didn’t occur before so I figured it must be something I’ve done that triggered this but…

---

## [Selling a p5.js code](https://discourse.processing.org/t/selling-a-p5-js-code/22830)

<div class="topic-metadata">

**Author:** [@papaboo](https://discourse.processing.org/u/papaboo)\
**Replies:** 1\
**Last updated:** [July 25, 2020, 3:26pm UTC](https://discourse.processing.org/t/selling-a-p5-js-code/22830 "2020-07-25T15:26:45Z")

</div>

Hello I know very little of MIT licensing. I got two questions. First: Am I allowed to sell my processing.js or p5.js project without any trouble? I’m not talking about p5.js library; only the source code of the app I…

---

## [Screen capture?](https://discourse.processing.org/t/screen-capture/22812)

<div class="topic-metadata">

**Author:** [@3rayio1](https://discourse.processing.org/u/3rayio1)\
**Replies:** 1\
**Last updated:** [July 24, 2020, 8:28pm UTC](https://discourse.processing.org/t/screen-capture/22812 "2020-07-24T20:28:49Z")

</div>

Hello! Im new to coding and I really like the p5.js editor as it is simple to learn and non-intimidating. I want to see if there is a way to have the program recognise things that occur on my computer screen and have it …

---

## [loadStrings only works in the editor](https://discourse.processing.org/t/loadstrings-only-works-in-the-editor/22807)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 3\
**Last updated:** [July 24, 2020, 5:43pm UTC](https://discourse.processing.org/t/loadstrings-only-works-in-the-editor/22807 "2020-07-24T17:43:55Z")

</div>

I downloaded this working sketch but it didn’t work on my desktop. Do I need a server to make loadStrings() get me a local disc file? I will downloaded the project in the future when I figure out how:) Mac 10.14.6. Th…

---

## [Security bug - sketches accessible to the world](https://discourse.processing.org/t/security-bug-sketches-accessible-to-the-world/22777)

<div class="topic-metadata">

**Author:** [@oshedar](https://discourse.processing.org/u/oshedar)\
**Replies:** 4\
**Last updated:** [July 23, 2020, 6:01am UTC](https://discourse.processing.org/t/security-bug-sketches-accessible-to-the-world/22777 "2020-07-23T06:01:21Z")

</div>

p5js has a security bug where everyone can see my sketches by typing following url in browser https://editor.p5js.org/myusername/sketches This makes it difficult to teach as my students have access to the answers to my …

---

## [Click and Drag to Scroll](https://discourse.processing.org/t/click-and-drag-to-scroll/22768)

<div class="topic-metadata">

**Author:** [@Hepyrian](https://discourse.processing.org/u/Hepyrian)\
**Replies:** 1\
**Last updated:** [July 22, 2020, 6:51pm UTC](https://discourse.processing.org/t/click-and-drag-to-scroll/22768 "2020-07-22T18:51:27Z")

</div>

Hey everyone, I’m working on a piece of software that’s mostly being designed for touch screens. You know how on a touch screen you scoll by touching and dragging? I am trying to implement that functionality into my pro…

---

## [Can we use p5.js logo for non commercial purposes?](https://discourse.processing.org/t/can-we-use-p5-js-logo-for-non-commercial-purposes/22775)

<div class="topic-metadata">

**Author:** [@misterybodon](https://discourse.processing.org/u/misterybodon)\
**Replies:** 1\
**Last updated:** [July 22, 2020, 6:23pm UTC](https://discourse.processing.org/t/can-we-use-p5-js-logo-for-non-commercial-purposes/22775 "2020-07-22T18:23:30Z")

</div>

I’ll be making a post about p5js, and it’d be nice to include a picture and the logo on the top layer of it. Is it ok if I use it? It’s just a blog coded from scratch with no adsense or rare things (just a ‘donate’ link…

---

## [Creating a grid on a flat surface (plane or otherwise)](https://discourse.processing.org/t/creating-a-grid-on-a-flat-surface-plane-or-otherwise/22753)

<div class="topic-metadata">

**Author:** [@redthanos](https://discourse.processing.org/u/redthanos)\
**Replies:** 3\
**Last updated:** [July 22, 2020, 7:57am UTC](https://discourse.processing.org/t/creating-a-grid-on-a-flat-surface-plane-or-otherwise/22753 "2020-07-22T07:57:36Z")

</div>

Hi everyone, i am new to processing and so far i’ve found it interesting to use in animating stuff on the web. I’ve come to a point where I want to create a 3D vector, or a surface for testing purposes, however I get a …

---

## [External Libraries Do Not Import Properly Into Web Editor](https://discourse.processing.org/t/external-libraries-do-not-import-properly-into-web-editor/22750)

<div class="topic-metadata">

**Author:** [@Hepyrian](https://discourse.processing.org/u/Hepyrian)\
**Replies:** 4\
**Last updated:** [July 21, 2020, 9:21pm UTC](https://discourse.processing.org/t/external-libraries-do-not-import-properly-into-web-editor/22750 "2020-07-21T21:21:00Z")

</div>

Hey Everyone! I’ve been having some issues with the p5 web editor, where I try to import an external library and it uploads with no text or feedback at all. Then, when I try to call a function from the library, it acts …

---

## [P5 standalone build for Browserify](https://discourse.processing.org/t/p5-standalone-build-for-browserify/22748)

<div class="topic-metadata">

**Author:** [@xinxin](https://discourse.processing.org/u/xinxin)\
**Replies:** 1\
**Last updated:** [July 21, 2020, 7:54pm UTC](https://discourse.processing.org/t/p5-standalone-build-for-browserify/22748 "2020-07-21T19:54:31Z")

</div>

Hi All, I’m trying to create a p5 standalone build with Browserify. I’ve installed the p5 package and following this stack overflow thread, I was able to export the p5 object and run the following code in my client.js: …

---

## [How move player in board](https://discourse.processing.org/t/how-move-player-in-board/22731)

<div class="topic-metadata">

**Author:** [@Xremix31](https://discourse.processing.org/u/Xremix31)\
**Replies:** 3\
**Last updated:** [July 20, 2020, 6:02pm UTC](https://discourse.processing.org/t/how-move-player-in-board/22731 "2020-07-20T18:02:00Z")

</div>

Hello, I’m having trouble making the player move on the board. I already corrected the post and put the functions in correct classes. How do I get the houses id and correct these two mistakes? I tried to declare the id i…

---

## [Calling WebGL functions from p5.js](https://discourse.processing.org/t/calling-webgl-functions-from-p5-js/22714)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 1\
**Last updated:** [July 19, 2020, 4:04am UTC](https://discourse.processing.org/t/calling-webgl-functions-from-p5-js/22714 "2020-07-19T04:04:39Z")

</div>

---

## [Webcam is not working on my mac pro](https://discourse.processing.org/t/webcam-is-not-working-on-my-mac-pro/22705)

<div class="topic-metadata">

**Author:** [@yejincolor](https://discourse.processing.org/u/yejincolor)\
**Replies:** 2\
**Last updated:** [July 19, 2020, 12:52am UTC](https://discourse.processing.org/t/webcam-is-not-working-on-my-mac-pro/22705 "2020-07-19T00:52:53Z")

</div>

In p5js editor, I wanted to test the example called “capture” to turn on my webcam on my mac pro. The code must be correct since I used the example that already existed, but the camera is not turning on and I do not know…

---

## [Draggable Images Triggering and Processing Sound](https://discourse.processing.org/t/draggable-images-triggering-and-processing-sound/22667)

<div class="topic-metadata">

**Author:** [@briangriffith](https://discourse.processing.org/u/briangriffith)\
**Replies:** 5\
**Last updated:** [July 17, 2020, 8:30pm UTC](https://discourse.processing.org/t/draggable-images-triggering-and-processing-sound/22667 "2020-07-17T20:30:52Z")

</div>

I am trying to figure out a way to do a fairly simple idea: I have two PNGs which are draggable across the canvas and I want each of them to trigger a loop. Beyond that, I want the position of the image to dictate the pa…

---

## [Tint image with alpha transparency in WEBGL](https://discourse.processing.org/t/tint-image-with-alpha-transparency-in-webgl/22002)

<div class="topic-metadata">

**Author:** [@dfd0226](https://discourse.processing.org/u/dfd0226)\
**Replies:** 2\
**Last updated:** [July 17, 2020, 4:52pm UTC](https://discourse.processing.org/t/tint-image-with-alpha-transparency-in-webgl/22002 "2020-07-17T16:52:43Z")

</div>

Hi all! Background I’m trying to figure out how to set the alpha channel on an image using tint when the sketch is in WEBGL mode. I’m building a React app that integrates p5.js. My code uses a physics library to create…

---

## [Designing the input](https://discourse.processing.org/t/designing-the-input/22451)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 6\
**Last updated:** [July 17, 2020, 12:00am UTC](https://discourse.processing.org/t/designing-the-input/22451 "2020-07-17T00:00:56Z")

</div>

i want to create an input whose width and increases with respect to how much you’ve written and to create another line… Can I do something like this??? I know I can do it for length… just by checking the input.value() …

---

## [Cull or Remove polygon backfaces with OpenGL](https://discourse.processing.org/t/cull-or-remove-polygon-backfaces-with-opengl/22673)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 0\
**Last updated:** [July 16, 2020, 10:00pm UTC](https://discourse.processing.org/t/cull-or-remove-polygon-backfaces-with-opengl/22673 "2020-07-16T22:00:29Z")

</div>

OpenGL has a command to cull backfaces “glCullFace”. I would like to know how to execute this. I want to view semi-wireframe images only showing framed front faces. This is a larger question on how to execute other Ope…

---

## [Lerp() not working as expected in animation between array position values](https://discourse.processing.org/t/lerp-not-working-as-expected-in-animation-between-array-position-values/22670)

<div class="topic-metadata">

**Author:** [@fpalla](https://discourse.processing.org/u/fpalla)\
**Replies:** 5\
**Last updated:** [July 16, 2020, 9:43pm UTC](https://discourse.processing.org/t/lerp-not-working-as-expected-in-animation-between-array-position-values/22670 "2020-07-16T21:43:47Z")

</div>

Hello forum/guys/people who understand js better than me, feels like kind of a noob question but I don’t think my knowledge at this point is sufficeint to figure out on my own. Either this or I’m blind to something. Rea…

---

## [P5.js bug report (semicolons)](https://discourse.processing.org/t/p5-js-bug-report-semicolons/22542)

<div class="topic-metadata">

**Author:** [@DavidMatuszek](https://discourse.processing.org/u/DavidMatuszek)\
**Replies:** 5\
**Last updated:** [July 16, 2020, 7:48pm UTC](https://discourse.processing.org/t/p5-js-bug-report-semicolons/22542 "2020-07-16T19:48:04Z")

</div>

JavaScript does not require semicolons at the end of lines. For the most part, p5.js does not require semicolons at the end of lines. Nevertheless, it appears that lines not ending in semicolons are being counted as err…

---

## [A function that takes in a function Y and a number, and returns a function which when called, invokes Y some number of times](https://discourse.processing.org/t/a-function-that-takes-in-a-function-y-and-a-number-and-returns-a-function-which-when-called-invokes-y-some-number-of-times/22512)

<div class="topic-metadata">

**Author:** [@Biggy](https://discourse.processing.org/u/Biggy)\
**Replies:** 5\
**Last updated:** [July 15, 2020, 1:02am UTC](https://discourse.processing.org/t/a-function-that-takes-in-a-function-y-and-a-number-and-returns-a-function-which-when-called-invokes-y-some-number-of-times/22512 "2020-07-15T01:02:14Z")

</div>

please format code with \</\> button \* homework policy \* asking questions function loopable(n, func) { return function (...args) { function looper() { if (n === 0) { return undefined; } n -=…

---

## [P5.new to start a new sketch on editor.p5js.org](https://discourse.processing.org/t/p5-new-to-start-a-new-sketch-on-editor-p5js-org/22621)

<div class="topic-metadata">

**Author:** [@haideralipunjabi](https://discourse.processing.org/u/haideralipunjabi)\
**Replies:** 0\
**Last updated:** [July 14, 2020, 4:25pm UTC](https://discourse.processing.org/t/p5-new-to-start-a-new-sketch-on-editor-p5js-org/22621 "2020-07-14T16:25:22Z")

</div>

Many organisations have started to use the .new TLD to create a shortcut for their web apps. Github has repo.new and gist.new to create a new repository & gist respectively. I also heard CodePen has one as well, but I ca…

---

## [How do I declare an array of objects?](https://discourse.processing.org/t/how-do-i-declare-an-array-of-objects/22591)

<div class="topic-metadata">

**Author:** [@fabeck01](https://discourse.processing.org/u/fabeck01)\
**Replies:** 2\
**Last updated:** [July 14, 2020, 1:54pm UTC](https://discourse.processing.org/t/how-do-i-declare-an-array-of-objects/22591 "2020-07-14T13:54:37Z")

</div>

Hello, I’m struggling with the definition of an array with the following (nested) structure - refer to picture: For each item in phase\[\] there should be: a title (string) a subtitle (string) an array of milestone …

---

## [Calling createGraphics() many times causing memory leak](https://discourse.processing.org/t/calling-creategraphics-many-times-causing-memory-leak/22388)

<div class="topic-metadata">

**Author:** [@benp](https://discourse.processing.org/u/benp)\
**Replies:** 4\
**Last updated:** [July 14, 2020, 12:59pm UTC](https://discourse.processing.org/t/calling-creategraphics-many-times-causing-memory-leak/22388 "2020-07-14T12:59:43Z")

</div>

I have a sketch I’ve been working on, and I found that calling createGraphics() repeatedly causes memory to not be freed. Representative example: var size = 600; function setup() { createCanvas(size, size); stroke(…

---

## [Preventing double tap to zoom on mobile (and other good practices)](https://discourse.processing.org/t/preventing-double-tap-to-zoom-on-mobile-and-other-good-practices/22581)

<div class="topic-metadata">

**Author:** [@kirkjerk](https://discourse.processing.org/u/kirkjerk)\
**Replies:** 0\
**Last updated:** [July 12, 2020, 9:06pm UTC](https://discourse.processing.org/t/preventing-double-tap-to-zoom-on-mobile-and-other-good-practices/22581 "2020-07-12T21:06:35Z")

</div>

is there a good way to prevent double taps from zooming in/out on the canvas? I found user-select: none; is good to stop the text from being highlighted… in theory touch-action: manipulation; should do similar for z…

---

## [Issues with different webcam resolutions & video capture](https://discourse.processing.org/t/issues-with-different-webcam-resolutions-video-capture/22568)

<div class="topic-metadata">

**Author:** [@Paraclete\_Pizza](https://discourse.processing.org/u/Paraclete_Pizza)\
**Replies:** 0\
**Last updated:** [July 12, 2020, 1:06pm UTC](https://discourse.processing.org/t/issues-with-different-webcam-resolutions-video-capture/22568 "2020-07-12T13:06:44Z")

</div>

Hi! I recently adapted my Processing curriculum to P5 for some remote teaching I’m doing, and an issue came up during our webcam project, owing to the students working on different computers with different webcam resolut…

---

## [Resizing problem: blurring images](https://discourse.processing.org/t/resizing-problem-blurring-images/22552)

<div class="topic-metadata">

**Author:** [@agrgal](https://discourse.processing.org/u/agrgal)\
**Replies:** 2\
**Last updated:** [July 12, 2020, 9:37am UTC](https://discourse.processing.org/t/resizing-problem-blurring-images/22552 "2020-07-12T09:37:00Z")

</div>

Hi to everybody, First of all, excuse my English. Besides of that, I’m a newbie on p5.js :slight\_smile: I developed a series of programs coded in p5.js and processing that you can find in: https://github.com/agrgal/sis…

---

## [How would my graph and background color change for amp difference?](https://discourse.processing.org/t/how-would-my-graph-and-background-color-change-for-amp-difference/22560)

<div class="topic-metadata">

**Author:** [@hanacho0220](https://discourse.processing.org/u/hanacho0220)\
**Replies:** 0\
**Last updated:** [July 12, 2020, 1:26am UTC](https://discourse.processing.org/t/how-would-my-graph-and-background-color-change-for-amp-difference/22560 "2020-07-12T01:26:41Z")

</div>

Hi, I was following the coding train’s sound visualization with p5.js tuturial and decided to make it for the music I composed. However, I want also want to change the color as an amplification changes and I have no ide…

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

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