# p5.js

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

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

**Page:** 85

---

## [loadImage issue](https://discourse.processing.org/t/loadimage-issue/14837)

<div class="topic-metadata">

**Author:** [@ylh](https://discourse.processing.org/u/ylh)\
**Replies:** 4\
**Last updated:** [October 21, 2019, 1:10pm UTC](https://discourse.processing.org/t/loadimage-issue/14837 "2019-10-21T13:10:17Z")

</div>

I have a trivial problem. I can’t seem to load an image file, which is in the same directory as the html code here https://editor.p5js.org/ylh888/sketches/wNPt1-pbY Running on my local browser, it shows the same “Loadin…

---

## [Persistent Shape with Mouse?](https://discourse.processing.org/t/persistent-shape-with-mouse/14739)

<div class="topic-metadata">

**Author:** [@yangs](https://discourse.processing.org/u/yangs)\
**Replies:** 8\
**Last updated:** [October 21, 2019, 3:04am UTC](https://discourse.processing.org/t/persistent-shape-with-mouse/14739 "2019-10-21T03:04:36Z")

</div>

Hi all! I suppose I’m not quite understanding the relationship between setup and draw and how to keep things persistent based on how the background is rendered. I was wondering how to keep something persistent with the …

---

## [Bar graphs Customized Library](https://discourse.processing.org/t/bar-graphs-customized-library/14740)

<div class="topic-metadata">

**Author:** [@Zubair231](https://discourse.processing.org/u/Zubair231)\
**Replies:** 3\
**Last updated:** [October 19, 2019, 7:55pm UTC](https://discourse.processing.org/t/bar-graphs-customized-library/14740 "2019-10-19T19:55:53Z")

</div>

Hi , this is Zubair here i want to made a custom library for bar graphs that have filter option against the time stamps and data name on graph visualization. I am new on p5.js so i need a graph visualization customize…

---

## [How does the canvas mix with html?](https://discourse.processing.org/t/how-does-the-canvas-mix-with-html/14787)

<div class="topic-metadata">

**Author:** [@tylerowens](https://discourse.processing.org/u/tylerowens)\
**Replies:** 4\
**Last updated:** [October 19, 2019, 7:44am UTC](https://discourse.processing.org/t/how-does-the-canvas-mix-with-html/14787 "2019-10-19T07:44:20Z")

</div>

Hello all, I am planning on starting my first p5js project, this is my first time in p5js but i have practiced in processing previously. My question is how to make the html elements go ontop of the canvas. what i mean …

---

## [Error when embedding one class inside another](https://discourse.processing.org/t/error-when-embedding-one-class-inside-another/14762)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 5\
**Last updated:** [October 17, 2019, 7:49pm UTC](https://discourse.processing.org/t/error-when-embedding-one-class-inside-another/14762 "2019-10-17T19:49:09Z")

</div>

Hi all, I’m trying to translate code from Processing to p5. The code embeds one class (Wheel) inside another (Car). I think that I’m close, but I’m getting an error message on line 70: backWheel is not defined. Is my i…

---

## [P5.js: How to use a function as an object parameter](https://discourse.processing.org/t/p5-js-how-to-use-a-function-as-an-object-parameter/14753)

<div class="topic-metadata">

**Author:** [@Pickle\_Butter](https://discourse.processing.org/u/Pickle_Butter)\
**Replies:** 4\
**Last updated:** [October 17, 2019, 4:04pm UTC](https://discourse.processing.org/t/p5-js-how-to-use-a-function-as-an-object-parameter/14753 "2019-10-17T16:04:44Z")

</div>

I want to make a button object in p5.js. To do this, I would need to use the button’s function as a parameter in the constructor. I tried using this as the constructor: constructor(ixp, iyp, iw, ih, itext, icolor1, icol…

---

## [Creating and saving file localy on p5](https://discourse.processing.org/t/creating-and-saving-file-localy-on-p5/14727)

<div class="topic-metadata">

**Author:** [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Replies:** 1\
**Last updated:** [October 16, 2019, 1:08am UTC](https://discourse.processing.org/t/creating-and-saving-file-localy-on-p5/14727 "2019-10-16T01:08:09Z")

</div>

Hi! I’m creating a file and i need to save inside a folder but wen i execute the createWriter() and close it, it’s automatically downloads on bowser. Is there a way to make it works as processing do? function preload()…

---

## [CreateCanvas - actual size is double?](https://discourse.processing.org/t/createcanvas-actual-size-is-double/14728)

<div class="topic-metadata">

**Author:** [@rdyar](https://discourse.processing.org/u/rdyar)\
**Replies:** 2\
**Last updated:** [October 15, 2019, 11:37pm UTC](https://discourse.processing.org/t/createcanvas-actual-size-is-double/14728 "2019-10-15T23:37:05Z")

</div>

if I make a canvas as 400x400 like (copied from p5 editor): function setup() { createCanvas(400, 400); } function draw() { background(220); } and then inspect the canvas element in Chrome I get: \<canvas id="defau…

---

## [Fontastic / export font](https://discourse.processing.org/t/fontastic-export-font/14233)

<div class="topic-metadata">

**Author:** [@lnp](https://discourse.processing.org/u/lnp)\
**Replies:** 1\
**Last updated:** [October 15, 2019, 6:31pm UTC](https://discourse.processing.org/t/fontastic-export-font/14233 "2019-10-15T18:31:24Z")

</div>

Hello all! Long term python lover - long ago I was in to my javascript and am now planning on getting in to p5js properly. I have a project in mind which is to allow users to export a font from the browser, outlines be…

---

## [Show folder content like Processing "File directory"](https://discourse.processing.org/t/show-folder-content-like-processing-file-directory/14583)

<div class="topic-metadata">

**Author:** [@hi.ke](https://discourse.processing.org/u/hi.ke)\
**Replies:** 7\
**Last updated:** [October 14, 2019, 7:10pm UTC](https://discourse.processing.org/t/show-folder-content-like-processing-file-directory/14583 "2019-10-14T19:10:22Z")

</div>

Hi peoples :smile: currently I’m working on an interactive slideshow in p5 which I previously built up in processing. It all works so far but I have some issues on making an easy way to load all the images. I have to sa…

---

## [File path for loading table](https://discourse.processing.org/t/file-path-for-loading-table/14697)

<div class="topic-metadata">

**Author:** [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Replies:** 1\
**Last updated:** [October 14, 2019, 5:18pm UTC](https://discourse.processing.org/t/file-path-for-loading-table/14697 "2019-10-14T17:18:51Z")

</div>

I have to load a file in a different folder. the current folder is “FileConverter”, and i have to open at “upload/FDR.csv” I try the following code but it doesent work function preload(){ table = loadTable(".…

---

## [404 image not found](https://discourse.processing.org/t/404-image-not-found/14649)

<div class="topic-metadata">

**Author:** [@sam](https://discourse.processing.org/u/sam)\
**Replies:** 1\
**Last updated:** [October 13, 2019, 3:47pm UTC](https://discourse.processing.org/t/404-image-not-found/14649 "2019-10-13T15:47:38Z")

</div>

Here is my code var canvas; let dirtImg; function preload() { dirtImg = loadImage('assets/blocks/dirt.png'); } function setup() { // put setup code here canvas = createCanvas(window.innerWidth, window.innerHeigh…

---

## [Problem with intersection algorithm](https://discourse.processing.org/t/problem-with-intersection-algorithm/14634)

<div class="topic-metadata">

**Author:** [@braintrance](https://discourse.processing.org/u/braintrance)\
**Replies:** 6\
**Last updated:** [October 13, 2019, 11:59am UTC](https://discourse.processing.org/t/problem-with-intersection-algorithm/14634 "2019-10-13T11:59:33Z")

</div>

This code is supposed to draw 20 circles that are not intersecting, but it doesn’t. Where is the error in this? var circles=\[\]; function setup() { createCanvas(600, 400); background(0); for(var i=0; i\<20; i++…

---

## [Stop() method for p5.Part not working?](https://discourse.processing.org/t/stop-method-for-p5-part-not-working/14618)

<div class="topic-metadata">

**Author:** [@leobrooks](https://discourse.processing.org/u/leobrooks)\
**Replies:** 0\
**Last updated:** [October 11, 2019, 9:07pm UTC](https://discourse.processing.org/t/stop-method-for-p5-part-not-working/14618 "2019-10-11T21:07:35Z")

</div>

Hello, I’m working on a program where the p5.Part and p5.Phrases are at the core of what I want it to be able to do. However, the stop() method, which says it should reset the Part to step 0 doesn’t seem to work. I know…

---

## [Two microphone inputs](https://discourse.processing.org/t/two-microphone-inputs/14321)

<div class="topic-metadata">

**Author:** [@l3ehfar](https://discourse.processing.org/u/l3ehfar)\
**Replies:** 3\
**Last updated:** [October 11, 2019, 8:40pm UTC](https://discourse.processing.org/t/two-microphone-inputs/14321 "2019-10-11T20:40:11Z")

</div>

I wanna know how to get two mic inputs in my p5js code. actually my sound card has two input channels and I wanna process each channel’s signal separated from the other in my code.

---

## [Spirograph with matrix transformations](https://discourse.processing.org/t/spirograph-with-matrix-transformations/14567)

<div class="topic-metadata">

**Author:** [@neotechnic](https://discourse.processing.org/u/neotechnic)\
**Replies:** 2\
**Last updated:** [October 11, 2019, 6:27am UTC](https://discourse.processing.org/t/spirograph-with-matrix-transformations/14567 "2019-10-11T06:27:06Z")

</div>

I am trying to create a simple spirograph project with matrix transformation technique. I took an algorithm based on sin math, but in the end driving paths do not match. Any idea why I get a different trajectory? trans…

---

## [Fireworks Question](https://discourse.processing.org/t/fireworks-question/14564)

<div class="topic-metadata">

**Author:** [@philspitler](https://discourse.processing.org/u/philspitler)\
**Replies:** 2\
**Last updated:** [October 10, 2019, 4:01am UTC](https://discourse.processing.org/t/fireworks-question/14564 "2019-10-10T04:01:04Z")

</div>

Hi, I have followed this great tutorial by @shiffman And am trying to weak one aspect of the animation without affecting other properties. Basically I want the tail (start of the firework) to shoot up fas…

---

## [Can't upload images](https://discourse.processing.org/t/cant-upload-images/14518)

<div class="topic-metadata">

**Author:** [@brianS](https://discourse.processing.org/u/brianS)\
**Replies:** 5\
**Last updated:** [October 9, 2019, 3:19am UTC](https://discourse.processing.org/t/cant-upload-images/14518 "2019-10-09T03:19:56Z")

</div>

Hi, I’m not sure if this the correct forum to post this in, but my students and I have been unable to upload image files for the last week or so. The Add Image dialog box allows us to drag in images, and gives us a chec…

---

## [3D Rotations: Rotating around the screen axes](https://discourse.processing.org/t/3d-rotations-rotating-around-the-screen-axes/14239)

<div class="topic-metadata">

**Author:** [@raetrakt](https://discourse.processing.org/u/raetrakt)\
**Replies:** 28\
**Last updated:** [October 8, 2019, 3:17pm UTC](https://discourse.processing.org/t/3d-rotations-rotating-around-the-screen-axes/14239 "2019-10-08T15:17:52Z")

</div>

I wanted a sphere to rotate in a way that the point closest to the viewer always rotates up when the cursor is moved upwards and always left and right when the cursor is moved left and right. I had problems because afte…

---

## [Switching from localhost to nodejs and express](https://discourse.processing.org/t/switching-from-localhost-to-nodejs-and-express/14377)

<div class="topic-metadata">

**Author:** [@Kent](https://discourse.processing.org/u/Kent)\
**Replies:** 4\
**Last updated:** [October 8, 2019, 3:44am UTC](https://discourse.processing.org/t/switching-from-localhost-to-nodejs-and-express/14377 "2019-10-08T03:44:53Z")

</div>

I’m trying to learn more about p5.js by following the working with data tutorials The code for both the fetch csv exercise(https://github.com/CodingTrain/Intro-to-Data-APIs-JS/tree/source/module1/02\_fetch\_csv\_exercise\_…

---

## [Preciso de ajuda processing audio desenho](https://discourse.processing.org/t/preciso-de-ajuda-processing-audio-desenho/14468)

<div class="topic-metadata">

**Author:** [@delucasouz](https://discourse.processing.org/u/delucasouz)\
**Replies:** 3\
**Last updated:** [October 8, 2019, 1:52am UTC](https://discourse.processing.org/t/preciso-de-ajuda-processing-audio-desenho/14468 "2019-10-08T01:52:53Z")

</div>

I need to develop a processing.js code that allows anyone to speak through the microphone to draw anything on the screen in a random, colorful way. Here’s an example: https://www.openprocessing.org/sketch/579128 Please …

---

## [Working with Parts and arrays/Drawing with sound](https://discourse.processing.org/t/working-with-parts-and-arrays-drawing-with-sound/14499)

<div class="topic-metadata">

**Author:** [@leobrooks](https://discourse.processing.org/u/leobrooks)\
**Replies:** 0\
**Last updated:** [October 7, 2019, 4:52pm UTC](https://discourse.processing.org/t/working-with-parts-and-arrays-drawing-with-sound/14499 "2019-10-07T16:52:52Z")

</div>

Hello, I am fairly new to coding in general and p5.js in particular, so please bear with me as I try to explain my question. I am trying to create a program that plays music based on reading arrays of ones and zeroes. …

---

## [Instance mode creating two canvas](https://discourse.processing.org/t/instance-mode-creating-two-canvas/14121)

<div class="topic-metadata">

**Author:** [@marlus](https://discourse.processing.org/u/marlus)\
**Replies:** 8\
**Last updated:** [October 7, 2019, 8:37am UTC](https://discourse.processing.org/t/instance-mode-creating-two-canvas/14121 "2019-10-07T08:37:09Z")

</div>

Hello there, I’m trying to use p5js instance mode, but I don’t know why, invoking new p5(sketch) create two canvases… const p5 = require('p5') global.p5 = p5 const sketch = () =\> { setup = () =\> { …

---

## [Why there exists a kinda blinking at some current?](https://discourse.processing.org/t/why-there-exists-a-kinda-blinking-at-some-current/14420)

<div class="topic-metadata">

**Author:** [@codemonic](https://discourse.processing.org/u/codemonic)\
**Replies:** 9\
**Last updated:** [October 5, 2019, 11:11am UTC](https://discourse.processing.org/t/why-there-exists-a-kinda-blinking-at-some-current/14420 "2019-10-05T11:11:06Z")

</div>

Hey, every 1, I just wanna make a copy of what’s this site displays in android browswer after entering, but the imitation is not as exact as I expect. At some time, the frame elements, for ballons objects, they blink, wh…

---

## [Planets with shadows](https://discourse.processing.org/t/planets-with-shadows/14309)

<div class="topic-metadata">

**Author:** [@Dohanr](https://discourse.processing.org/u/Dohanr)\
**Replies:** 3\
**Last updated:** [October 4, 2019, 12:16pm UTC](https://discourse.processing.org/t/planets-with-shadows/14309 "2019-10-04T12:16:01Z")

</div>

hope someone can help me with this. I’m using the p5.js lib in webGL. I have a sphere as earth rotating around x,y,z coordinates (0,0,0 - where the sun would be) then a I have another smaller sphere rotating around earth…

---

## [Audio Issue: Safari and iOS](https://discourse.processing.org/t/audio-issue-safari-and-ios/7485)

<div class="topic-metadata">

**Author:** [@djw](https://discourse.processing.org/u/djw)\
**Replies:** 2\
**Last updated:** [October 4, 2019, 1:45am UTC](https://discourse.processing.org/t/audio-issue-safari-and-ios/7485 "2019-10-04T01:45:28Z")

</div>

I’ve just been working on a simple p5.js script and thought it was working well as in Chrome things are fine: now.danieljwilson.com However I just get Loading... when I try to view it on Safari or on Chrome on my iPad. …

---

## [applyMatrix to mouseX and mouseY](https://discourse.processing.org/t/applymatrix-to-mousex-and-mousey/14242)

<div class="topic-metadata">

**Author:** [@Jithin](https://discourse.processing.org/u/Jithin)\
**Replies:** 9\
**Last updated:** [October 2, 2019, 6:54am UTC](https://discourse.processing.org/t/applymatrix-to-mousex-and-mousey/14242 "2019-10-02T06:54:04Z")

</div>

When I use applyMatrix in a sketch to transform the coordinates, the mouseX and mouseY is not transformed accordingly. The sketch explains the problem. https://editor.p5js.org/jithunni.ks/sketches/p9Q0JnE\_l Is there a…

---

## [Full Page Canvas for Album Art Project](https://discourse.processing.org/t/full-page-canvas-for-album-art-project/14328)

<div class="topic-metadata">

**Author:** [@bradley](https://discourse.processing.org/u/bradley)\
**Replies:** 2\
**Last updated:** [October 2, 2019, 4:31am UTC](https://discourse.processing.org/t/full-page-canvas-for-album-art-project/14328 "2019-10-02T04:31:52Z")

</div>

I have an idea to make a website for an album my friends and I made that does some interactive stuff with photos that a user would upload and then with p5 various effects and stuff would happen. I was thinking of just co…

---

## [Make an authenticated JSON request](https://discourse.processing.org/t/make-an-authenticated-json-request/14224)

<div class="topic-metadata">

**Author:** [@prismspecs](https://discourse.processing.org/u/prismspecs)\
**Replies:** 5\
**Last updated:** [October 1, 2019, 6:29pm UTC](https://discourse.processing.org/t/make-an-authenticated-json-request/14224 "2019-10-01T18:29:00Z")

</div>

I see this page https://p5js.org/reference/#/p5/httpDo But when I try to make an API request with my access token from https://littlesis.org/api it doesn’t work. I see that LittleSis wants the string “Littlesis-Api-To…

---

## [textWidth() issues](https://discourse.processing.org/t/textwidth-issues/14218)

<div class="topic-metadata">

**Author:** [@GildasP](https://discourse.processing.org/u/GildasP)\
**Replies:** 4\
**Last updated:** [October 1, 2019, 1:17pm UTC](https://discourse.processing.org/t/textwidth-issues/14218 "2019-10-01T13:17:18Z")

</div>

Hi there. I’m using textWidth() to fit texts horizontaly in a fixed width. Doing so works great, I check for the textWidth() of my text in size 100, then I calculate in which size it would perfectly fit my fixed width …

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

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