# p5.js

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

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

**Page:** 81

---

## [Flickering in Exclusion](https://discourse.processing.org/t/flickering-in-exclusion/16760)

<div class="topic-metadata">

**Author:** [@musiciantriescoding](https://discourse.processing.org/u/musiciantriescoding)\
**Replies:** 8\
**Last updated:** [December 31, 2019, 10:01pm UTC](https://discourse.processing.org/t/flickering-in-exclusion/16760 "2019-12-31T22:01:33Z")

</div>

Hi everyone! I’m trying to play with the blend modes in P5, specifically to play around with black and white. When I use the code below, I expected a black line across a white canvas. However, I got the line and the canv…

---

## [CORS issue when loading JSON in p5](https://discourse.processing.org/t/cors-issue-when-loading-json-in-p5/16727)

<div class="topic-metadata">

**Author:** [@gjs](https://discourse.processing.org/u/gjs)\
**Replies:** 2\
**Last updated:** [December 30, 2019, 8:19pm UTC](https://discourse.processing.org/t/cors-issue-when-loading-json-in-p5/16727 "2019-12-30T20:19:38Z")

</div>

I’m attempting to load a JSON and receive the following message: “Access to fetch at ‘https://api.flightstats.com/flex/schedules/rest/v1/json/flight/AA/100/departing/2020/1/31?appId=XXX&appKey=XXX’ from origin ‘https://…

---

## [Zoom and save as png](https://discourse.processing.org/t/zoom-and-save-as-png/16729)

<div class="topic-metadata">

**Author:** [@monk-e-boy](https://discourse.processing.org/u/monk-e-boy)\
**Replies:** 4\
**Last updated:** [December 30, 2019, 8:00pm UTC](https://discourse.processing.org/t/zoom-and-save-as-png/16729 "2019-12-30T20:00:03Z")

</div>

I can save my canvas as a .png :slight\_smile: how do I zoom it in first? I am creating a D&D grid, I would like to save it so each square is 1 inch across. I would like to save it with a transparent background. https:…

---

## [If condition breaks for loop in recursive function](https://discourse.processing.org/t/if-condition-breaks-for-loop-in-recursive-function/16717)

<div class="topic-metadata">

**Author:** [@musiciantriescoding](https://discourse.processing.org/u/musiciantriescoding)\
**Replies:** 3\
**Last updated:** [December 30, 2019, 11:08am UTC](https://discourse.processing.org/t/if-condition-breaks-for-loop-in-recursive-function/16717 "2019-12-30T11:08:08Z")

</div>

Hi everyone! I have come across what I think may be a bug. I am just testing a recursive function which: Draws 6 circles around a circle for each circle, draw 6 circles around it. This is the following code I wrote. (…

---

## [Can I use multiple p5.js on my website..?](https://discourse.processing.org/t/can-i-use-multiple-p5-js-on-my-website/16522)

<div class="topic-metadata">

**Author:** [@Sejin.OH](https://discourse.processing.org/u/Sejin.OH)\
**Replies:** 2\
**Last updated:** [December 29, 2019, 4:29pm UTC](https://discourse.processing.org/t/can-i-use-multiple-p5-js-on-my-website/16522 "2019-12-29T16:29:21Z")

</div>

Hello, I have a website where I want to use my portfolio… but I tried my work(p5.js) with a script on my website but couldn’t succeed more than one. Is there a way to upload multiple p5.js in html differently? Thanks fo…

---

## [Error in installing](https://discourse.processing.org/t/error-in-installing/16660)

<div class="topic-metadata">

**Author:** [@artemp28](https://discourse.processing.org/u/artemp28)\
**Replies:** 5\
**Last updated:** [December 28, 2019, 2:19pm UTC](https://discourse.processing.org/t/error-in-installing/16660 "2019-12-28T14:19:17Z")

</div>

Why am i getting this error? How to solve it?

---

## [Problem with installation](https://discourse.processing.org/t/problem-with-installation/16529)

<div class="topic-metadata">

**Author:** [@niravasher](https://discourse.processing.org/u/niravasher)\
**Replies:** 2\
**Last updated:** [December 28, 2019, 2:17pm UTC](https://discourse.processing.org/t/problem-with-installation/16529 "2019-12-28T14:17:13Z")

</div>

Hi! my name is Nirav Asher, I am from Mumbai, India. I am trying to contribute to processing/p5.js. I am working on Ubuntu 19.04. I will be trying for GSOC 2020. When I run npm run grunt, I get the following warning a l…

---

## [Using textToPoints() with an already loaded font](https://discourse.processing.org/t/using-texttopoints-with-an-already-loaded-font/16651)

<div class="topic-metadata">

**Author:** [@Seyka](https://discourse.processing.org/u/Seyka)\
**Replies:** 3\
**Last updated:** [December 27, 2019, 2:17pm UTC](https://discourse.processing.org/t/using-texttopoints-with-an-already-loaded-font/16651 "2019-12-27T14:17:02Z")

</div>

Hi, I am using the textToPoints() function in a project, but since textToPoints() is part of the prototype of p5.Font I need to use it with a font loaded with loadFont(). But I can’t find a way to get a reference to an …

---

## [Glitches and crashes appearing on p5.js app in Google Chrome](https://discourse.processing.org/t/glitches-and-crashes-appearing-on-p5-js-app-in-google-chrome/16641)

<div class="topic-metadata">

**Author:** [@Ackados](https://discourse.processing.org/u/Ackados)\
**Replies:** 1\
**Last updated:** [December 27, 2019, 11:16am UTC](https://discourse.processing.org/t/glitches-and-crashes-appearing-on-p5-js-app-in-google-chrome/16641 "2019-12-27T11:16:12Z")

</div>

I am not sure if this a problem from my code or a problem from Google Chrome itself, but I am seeing this “glitch”. Then after a while this tab that I am working on with Processing “crashes” or restarts. I don’t see a…

---

## [Drawing triangle to face toward it's velocity](https://discourse.processing.org/t/drawing-triangle-to-face-toward-its-velocity/16642)

<div class="topic-metadata">

**Author:** [@Ackados](https://discourse.processing.org/u/Ackados)\
**Replies:** 2\
**Last updated:** [December 27, 2019, 2:01am UTC](https://discourse.processing.org/t/drawing-triangle-to-face-toward-its-velocity/16642 "2019-12-27T02:01:21Z")

</div>

I know you can use vector.heading() to get the angle of direction. I have been using this in my code but it’s not working correctly. class Boid { constructor() { this.loc = createVector(); this.vel =…

---

## [Two canvases on the same page + keyboard](https://discourse.processing.org/t/two-canvases-on-the-same-page-keyboard/16645)

<div class="topic-metadata">

**Author:** [@tanzor](https://discourse.processing.org/u/tanzor)\
**Replies:** 3\
**Last updated:** [December 26, 2019, 8:54pm UTC](https://discourse.processing.org/t/two-canvases-on-the-same-page-keyboard/16645 "2019-12-26T20:54:40Z")

</div>

Hello community, I’m trying to have two canvases within the same HTML page, such that both canvases react to key presses. For some reason only the first canvas is reactive, and the second canvas is not. Here’s a minimi…

---

## [Javascript Error reporting variable already declared](https://discourse.processing.org/t/javascript-error-reporting-variable-already-declared/16551)

<div class="topic-metadata">

**Author:** [@Dandada](https://discourse.processing.org/u/Dandada)\
**Replies:** 2\
**Last updated:** [December 21, 2019, 5:06pm UTC](https://discourse.processing.org/t/javascript-error-reporting-variable-already-declared/16551 "2019-12-21T17:06:01Z")

</div>

I created an example of a simply particle system after watching one of Dan Shiffman’s video. However it gives an error “Uncaught SyntaxError: Identifier ‘location’ has already been declared (sketch: line 1)” which make n…

---

## [How to change object size upon bouncing in p5.play](https://discourse.processing.org/t/how-to-change-object-size-upon-bouncing-in-p5-play/16540)

<div class="topic-metadata">

**Author:** [@blkpanther](https://discourse.processing.org/u/blkpanther)\
**Replies:** 4\
**Last updated:** [December 21, 2019, 4:34am UTC](https://discourse.processing.org/t/how-to-change-object-size-upon-bouncing-in-p5-play/16540 "2019-12-21T04:34:17Z")

</div>

I don’t know how to change the length of an object upon bouncing interaction in p5.play. In the code below, I wish to make the bar shorter from the top upon every hit, but don’t know what keyword to search for in the ref…

---

## [Help with my first contribution](https://discourse.processing.org/t/help-with-my-first-contribution/16305)

<div class="topic-metadata">

**Author:** [@teddysphotos](https://discourse.processing.org/u/teddysphotos)\
**Replies:** 5\
**Last updated:** [December 21, 2019, 3:46am UTC](https://discourse.processing.org/t/help-with-my-first-contribution/16305 "2019-12-21T03:46:12Z")

</div>

I came across the p5.js library 3 weeks ago and I have been hooked since then. I learned the basics of p5.js from The Coding Train on YouTube. Now I want to do a little more complex/open-source projects to enhance my kno…

---

## [Texture Wrapping](https://discourse.processing.org/t/texture-wrapping/16534)

<div class="topic-metadata">

**Author:** [@Samira](https://discourse.processing.org/u/Samira)\
**Replies:** 0\
**Last updated:** [December 20, 2019, 12:17pm UTC](https://discourse.processing.org/t/texture-wrapping/16534 "2019-12-20T12:17:00Z")

</div>

I’ve just started working more with WebGL and I came across a problem. I want a texture to repeat along a box but it’s just stretching. I know that textureWrap() should solve this, but for some reason, it’s still stretch…

---

## [Why does p5.min.js apparently contain the whole p5.js documentation?](https://discourse.processing.org/t/why-does-p5-min-js-apparently-contain-the-whole-p5-js-documentation/16293)

<div class="topic-metadata">

**Author:** [@lorenzki](https://discourse.processing.org/u/lorenzki)\
**Replies:** 10\
**Last updated:** [December 20, 2019, 10:11am UTC](https://discourse.processing.org/t/why-does-p5-min-js-apparently-contain-the-whole-p5-js-documentation/16293 "2019-12-20T10:11:13Z")

</div>

I used p5.js occasionally over the past 2 years for playing around and experimenting. Now I want to use it for a more serious project - and one concern is the filesize of p5.min.js. I am using the npm version, but it s…

---

## [Video Playback Problem](https://discourse.processing.org/t/video-playback-problem/16520)

<div class="topic-metadata">

**Author:** [@Comradetony](https://discourse.processing.org/u/Comradetony)\
**Replies:** 1\
**Last updated:** [December 20, 2019, 2:12am UTC](https://discourse.processing.org/t/video-playback-problem/16520 "2019-12-20T02:12:37Z")

</div>

Hi. I’m trying to make it so this sketch plays videos upon clicking the images, but so far I have not been able to make the videos play at all, let alone swap between them freely. var immol; var i = 'Immolation1.mp4'; v…

---

## [Div as Canvas -\> possible to save down?](https://discourse.processing.org/t/div-as-canvas-possible-to-save-down/16478)

<div class="topic-metadata">

**Author:** [@potipoo](https://discourse.processing.org/u/potipoo)\
**Replies:** 1\
**Last updated:** [December 18, 2019, 1:21am UTC](https://discourse.processing.org/t/div-as-canvas-possible-to-save-down/16478 "2019-12-18T01:21:03Z")

</div>

Hi, I’ve created a document where all my p5.js code changes the attributes of a I am now wondering, is there a way of saving down the div? or to make the div appear as a canvas? Thanks in advance, Cheers Andy

---

## [Use p5 on existing canvas](https://discourse.processing.org/t/use-p5-on-existing-canvas/16307)

<div class="topic-metadata">

**Author:** [@tanzor](https://discourse.processing.org/u/tanzor)\
**Replies:** 4\
**Last updated:** [December 17, 2019, 8:49pm UTC](https://discourse.processing.org/t/use-p5-on-existing-canvas/16307 "2019-12-17T20:49:31Z")

</div>

Hey community! Is there a way to sketch with p5 within an existing javascript canvas? (i.e., one that was not opened using p5)? Thanks, Tan

---

## [Problem with using Firebase in online P5 Editor](https://discourse.processing.org/t/problem-with-using-firebase-in-online-p5-editor/11642)

<div class="topic-metadata">

**Author:** [@rsklarew](https://discourse.processing.org/u/rsklarew)\
**Replies:** 3\
**Last updated:** [December 17, 2019, 11:44am UTC](https://discourse.processing.org/t/problem-with-using-firebase-in-online-p5-editor/11642 "2019-12-17T11:44:52Z")

</div>

Firebase realtime database works fine in the old offline P5 editor. But when I use the same code in the new online editor, the variable firebase is not recognized: \*"Uncaught ReferenceError: firebase is not defi…

---

## [Getting nothing when trying to show image with the help of HTML tag](https://discourse.processing.org/t/getting-nothing-when-trying-to-show-image-with-the-help-of-html-tag/16378)

<div class="topic-metadata">

**Author:** [@RadheTians](https://discourse.processing.org/u/RadheTians)\
**Replies:** 6\
**Last updated:** [December 16, 2019, 6:47am UTC](https://discourse.processing.org/t/getting-nothing-when-trying-to-show-image-with-the-help-of-html-tag/16378 "2019-12-16T06:47:37Z")

</div>

I noticed that when I was trying to show an image on canvas with the help of HTML tags(i.e input tag and type is file) the codebase wasn’t showing an image and when I was trying to show with the help of p5.js function c…

---

## [Change x position of an array of lines](https://discourse.processing.org/t/change-x-position-of-an-array-of-lines/16427)

<div class="topic-metadata">

**Author:** [@Tilia](https://discourse.processing.org/u/Tilia)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 3:18am UTC](https://discourse.processing.org/t/change-x-position-of-an-array-of-lines/16427 "2019-12-16T03:18:51Z")

</div>

hi Leute could someone explain me why i cannot change the x position of an array of lines by pressing the arrow keyes? the lines (looking like a sun) have all the same x position (0,0) translated to the middle of the c…

---

## [P5.js documentation suggestions](https://discourse.processing.org/t/p5-js-documentation-suggestions/16016)

<div class="topic-metadata">

**Author:** [@natkuhn](https://discourse.processing.org/u/natkuhn)\
**Replies:** 2\
**Last updated:** [December 14, 2019, 12:30pm UTC](https://discourse.processing.org/t/p5-js-documentation-suggestions/16016 "2019-12-14T12:30:29Z")

</div>

Hi, I stumbled on p5.js because I wanted to use p5.sound on a React project. (I didn’t spot another sound library with the pan() feature, which I need.) It looks like a very cool resource and community. I can see that a …

---

## [Does p5.js or processing have any commercial use?](https://discourse.processing.org/t/does-p5-js-or-processing-have-any-commercial-use/16377)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 1\
**Last updated:** [December 13, 2019, 6:02pm UTC](https://discourse.processing.org/t/does-p5-js-or-processing-have-any-commercial-use/16377 "2019-12-13T18:02:55Z")

</div>

Does p5.js or processing have any commercial use? If so, what type of business do you generally use?

---

## [Problems with the video.size (number1, number2) function;](https://discourse.processing.org/t/problems-with-the-video-size-number1-number2-function/16331)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 7\
**Last updated:** [December 13, 2019, 12:36pm UTC](https://discourse.processing.org/t/problems-with-the-video-size-number1-number2-function/16331 "2019-12-13T12:36:21Z")

</div>

Now in 2019, for reasons of some update of P5.JS or browsers, the video.size function (number1, number2); Does not work, breaking or code. Here is the error: undefined p5.js: 61127 Uncaught IndexSizeError: Failed to …

---

## [Update canvas when scrolling](https://discourse.processing.org/t/update-canvas-when-scrolling/16160)

<div class="topic-metadata">

**Author:** [@clankill3r](https://discourse.processing.org/u/clankill3r)\
**Replies:** 2\
**Last updated:** [December 12, 2019, 8:42am UTC](https://discourse.processing.org/t/update-canvas-when-scrolling/16160 "2019-12-12T08:42:07Z")

</div>

I have elements in the dom and I draw certain overlays using a canvas. The problem is that often the render of the dom happens before the canvas is updated and therefore they are not in sync: Is there any way to make…

---

## [Play Animation within p5js/Hover Effect on Objects](https://discourse.processing.org/t/play-animation-within-p5js-hover-effect-on-objects/16306)

<div class="topic-metadata">

**Author:** [@van326](https://discourse.processing.org/u/van326)\
**Replies:** 4\
**Last updated:** [December 11, 2019, 4:21am UTC](https://discourse.processing.org/t/play-animation-within-p5js-hover-effect-on-objects/16306 "2019-12-11T04:21:31Z")

</div>

Hello! Long story short, I am trying to have animations and audio play in a loop when the user clicks on certain objects. I have looked up the Coding Train videos and have gotten some help for most parts of my project, b…

---

## [Ml5 NetworkError](https://discourse.processing.org/t/ml5-networkerror/16191)

<div class="topic-metadata">

**Author:** [@coco](https://discourse.processing.org/u/coco)\
**Replies:** 8\
**Last updated:** [December 10, 2019, 8:51am UTC](https://discourse.processing.org/t/ml5-networkerror/16191 "2019-12-10T08:51:13Z")

</div>

I’m trying to get the Image Classifier demo to work (using a local server) but I keep getting a “NetworkError when attempting to fetch resource” error… It apparently has something to do with CORS but I can’t seem to a…

---

## [About the p5.js Editor and Enhancements](https://discourse.processing.org/t/about-the-p5-js-editor-and-enhancements/15913)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 6\
**Last updated:** [December 9, 2019, 3:52pm UTC](https://discourse.processing.org/t/about-the-p5-js-editor-and-enhancements/15913 "2019-12-09T15:52:32Z")

</div>

Hello, what do you think of when we create our projects, they appear as screen print in our URL ?? For example, going to https://editor.p5js.org/willianxz/ should appear a list of my projects in the form of images, this…

---

## [About the P5.JS Editor](https://discourse.processing.org/t/about-the-p5-js-editor/15835)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 2\
**Last updated:** [December 9, 2019, 2:08am UTC](https://discourse.processing.org/t/about-the-p5-js-editor/15835 "2019-12-09T02:08:04Z")

</div>

It would be very interesting if when saving the project, the project was saved with a screenshot taken, so when we open our projects we will have a preview of what it is. It would also be nice to have a place with other…

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

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