# p5.js

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

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

**Page:** 63

---

## [Want to store data from array to file in p5.js](https://discourse.processing.org/t/want-to-store-data-from-array-to-file-in-p5-js/23498)

<div class="topic-metadata">

**Author:** [@iamgsshetty](https://discourse.processing.org/u/iamgsshetty)\
**Replies:** 1\
**Last updated:** [August 26, 2020, 8:21am UTC](https://discourse.processing.org/t/want-to-store-data-from-array-to-file-in-p5-js/23498 "2020-08-26T08:21:06Z")

</div>

let video; let posNet; let pose; let skeleton; var a=0,b=0,c=0; var rec\_pose=\[\]; var rec\_skeleton=\[\]; var fs=require(‘fs’) function setup() { createCanvas(1400, 700); video=createCapture(VIDEO); video.hide(); …

---

## [strokeWeight(1) draws 2 pixel width](https://discourse.processing.org/t/strokeweight-1-draws-2-pixel-width/23425)

<div class="topic-metadata">

**Author:** [@FunThomas](https://discourse.processing.org/u/FunThomas)\
**Replies:** 7\
**Last updated:** [August 24, 2020, 11:07pm UTC](https://discourse.processing.org/t/strokeweight-1-draws-2-pixel-width/23425 "2020-08-24T23:07:21Z")

</div>

While playing with some basic stuff, I found that some of my drawings seemd to be off. After some fiddling, I found that if I use strokeWeight(1), the line or rect has in fact a width of 2 pixels. I tried Firefox and Chr…

---

## [Ccapture with up to date p5js](https://discourse.processing.org/t/ccapture-with-up-to-date-p5js/23467)

<div class="topic-metadata">

**Author:** [@Hapiel](https://discourse.processing.org/u/Hapiel)\
**Replies:** 2\
**Last updated:** [August 24, 2020, 10:28pm UTC](https://discourse.processing.org/t/ccapture-with-up-to-date-p5js/23467 "2020-08-24T22:28:16Z")

</div>

Hi guys, I was trying to work out how to save animations with ccapture, a js library. I couldn’t get it to work, so I looked up an example that uses p5 and ccapture and found one here. After getting confused for a long…

---

## [Why does windowWidth not trigger?](https://discourse.processing.org/t/why-does-windowwidth-not-trigger/23473)

<div class="topic-metadata">

**Author:** [@Clebosevic](https://discourse.processing.org/u/Clebosevic)\
**Replies:** 0\
**Last updated:** [August 24, 2020, 5:15pm UTC](https://discourse.processing.org/t/why-does-windowwidth-not-trigger/23473 "2020-08-24T17:15:51Z")

</div>

So my code is rather simple, it looks at an image and for every pixel brighter than a threshold, it puts a one there, which in turn just creates a interpretation of that image (code below): let grid = \[\]; const gridSize…

---

## [Trying to convert a basic grow shrink sketch from processing to p5.js](https://discourse.processing.org/t/trying-to-convert-a-basic-grow-shrink-sketch-from-processing-to-p5-js/23389)

<div class="topic-metadata">

**Author:** [@BackTo](https://discourse.processing.org/u/BackTo)\
**Replies:** 4\
**Last updated:** [August 24, 2020, 12:26pm UTC](https://discourse.processing.org/t/trying-to-convert-a-basic-grow-shrink-sketch-from-processing-to-p5-js/23389 "2020-08-24T12:26:31Z")

</div>

Hi, I’m trying to convert a processing 3 sketch that works to a p5.js and I can’t wrap my head around what the changes are or where to find a translation guide. I think if I can crack this conversion I’ll be able to do …

---

## [Create multiple custom rectangles in p5.js](https://discourse.processing.org/t/create-multiple-custom-rectangles-in-p5-js/23459)

<div class="topic-metadata">

**Author:** [@Axiang1225](https://discourse.processing.org/u/Axiang1225)\
**Replies:** 1\
**Last updated:** [August 24, 2020, 7:14am UTC](https://discourse.processing.org/t/create-multiple-custom-rectangles-in-p5-js/23459 "2020-08-24T07:14:43Z")

</div>

I’m beginning to explore p5.js web editor, and I was wondering if there is a way to create multiple custom rectangles with mouse in canvas.That’s the only way I can think of. I want it be like Illustrator’s rectangle too…

---

## [I need save values the list points and sum new values without sum id](https://discourse.processing.org/t/i-need-save-values-the-list-points-and-sum-new-values-without-sum-id/23334)

<div class="topic-metadata">

**Author:** [@Xremix31](https://discourse.processing.org/u/Xremix31)\
**Replies:** 2\
**Last updated:** [August 22, 2020, 10:27am UTC](https://discourse.processing.org/t/i-need-save-values-the-list-points-and-sum-new-values-without-sum-id/23334 "2020-08-22T10:27:42Z")

</div>

Hi, I need save the last values for sum new values in points to show the cards in the same position the player. But i have a problem when try first time the position is correct and the same numbers of dices, but when try…

---

## [How to use \*require.js\* to load another library inside p5](https://discourse.processing.org/t/how-to-use-require-js-to-load-another-library-inside-p5/23362)

<div class="topic-metadata">

**Author:** [@watermelon2020](https://discourse.processing.org/u/watermelon2020)\
**Replies:** 1\
**Last updated:** [August 22, 2020, 9:38am UTC](https://discourse.processing.org/t/how-to-use-require-js-to-load-another-library-inside-p5/23362 "2020-08-22T09:38:01Z")

</div>

Hi, I’d like to use the ‘require.js’ library in p5.js to load another library, say ‘fast-csv’ I’ve done locally: npm install fast-csv modify the index.html to include the ‘require’: \<script src=“https://cdnjs.cloudf…

---

## [The only I see is the message: "Loading..." :-(](https://discourse.processing.org/t/the-only-i-see-is-the-message-loading/23394)

<div class="topic-metadata">

**Author:** [@mancpato](https://discourse.processing.org/u/mancpato)\
**Replies:** 5\
**Last updated:** [August 21, 2020, 7:32pm UTC](https://discourse.processing.org/t/the-only-i-see-is-the-message-loading/23394 "2020-08-21T19:32:56Z")

</div>

I wrote my sketch in the online editor and runs very well. I download it and double clicked index.html, but there is only the “Loading…” message. What am I doing wrong?

---

## [Help running PeerJS 'Hello World' example (in Web Editor)](https://discourse.processing.org/t/help-running-peerjs-hello-world-example-in-web-editor/23403)

<div class="topic-metadata">

**Author:** [@ottenm](https://discourse.processing.org/u/ottenm)\
**Replies:** 1\
**Last updated:** [August 21, 2020, 1:38pm UTC](https://discourse.processing.org/t/help-running-peerjs-hello-world-example-in-web-editor/23403 "2020-08-21T13:38:33Z")

</div>

I’m struggling to get the following example of p5js/PeerJS up and running: https://editor.p5js.org/creativecoding/sketches/a9tDT2M1\_ I open the same page in 2 different windows and launch the first one as-is, including…

---

## [Translating everything/ moving on the canvas](https://discourse.processing.org/t/translating-everything-moving-on-the-canvas/23409)

<div class="topic-metadata">

**Author:** [@Luis\_Luethi1](https://discourse.processing.org/u/Luis_Luethi1)\
**Replies:** 1\
**Last updated:** [August 21, 2020, 9:19am UTC](https://discourse.processing.org/t/translating-everything-moving-on-the-canvas/23409 "2020-08-21T09:19:48Z")

</div>

Hi, I want to move over my canvas by clicking and dragging. With the code below, the rect is getting reinstatiated every time the mouse is clicked. How can I change the code, so the rect is being translated from its new…

---

## [How to start 2 node servers](https://discourse.processing.org/t/how-to-start-2-node-servers/23390)

<div class="topic-metadata">

**Author:** [@stephanschulz](https://discourse.processing.org/u/stephanschulz)\
**Replies:** 3\
**Last updated:** [August 21, 2020, 1:46am UTC](https://discourse.processing.org/t/how-to-start-2-node-servers/23390 "2020-08-21T01:46:55Z")

</div>

I am using p5js and ml5js to run a local project that tracks a person and saves images to a local folder. For this to work I have to use https://github.com/ml5js/ml5-data-and-models-server to serve the ml models locally…

---

## [p5.Image is fuzzy](https://discourse.processing.org/t/p5-image-is-fuzzy/23395)

<div class="topic-metadata">

**Author:** [@Hapiel](https://discourse.processing.org/u/Hapiel)\
**Replies:** 10\
**Last updated:** [August 20, 2020, 11:42pm UTC](https://discourse.processing.org/t/p5-image-is-fuzzy/23395 "2020-08-20T23:42:05Z")

</div>

As soon as a p5.Graphics element gets stored in a p5.Image element, it gets a bit fuzzier. Some smoother anti alias I think. The effect is subtle, but visible to me. Is there a way to prevent this? I’m trying to make …

---

## [How to get familiar with the p5.js codebase](https://discourse.processing.org/t/how-to-get-familiar-with-the-p5-js-codebase/23387)

<div class="topic-metadata">

**Author:** [@Swapnil](https://discourse.processing.org/u/Swapnil)\
**Replies:** 1\
**Last updated:** [August 20, 2020, 8:19pm UTC](https://discourse.processing.org/t/how-to-get-familiar-with-the-p5-js-codebase/23387 "2020-08-20T20:19:52Z")

</div>

I’m a beginner in open source contribution and I would love to contribute to the p5.js repository. But the codebase is pretty massive and I don’t really know which is the best place to start. I would thoroughly appreciat…

---

## [Putting Java Sketches online](https://discourse.processing.org/t/putting-java-sketches-online/4571)

<div class="topic-metadata">

**Author:** [@henri](https://discourse.processing.org/u/henri)\
**Replies:** 2\
**Last updated:** [August 20, 2020, 4:41pm UTC](https://discourse.processing.org/t/putting-java-sketches-online/4571 "2020-08-20T16:41:50Z")

</div>

Hi, I have managed to get a few Java sketches embedded on my website but I’m stuck with one and would appreciate any ideas, or things I’m missing about converting to p5.js. So I found this helpful link a few days ago s…

---

## [Code issue\\ A bug that killed me (P5)](https://discourse.processing.org/t/code-issue-a-bug-that-killed-me-p5/23363)

<div class="topic-metadata">

**Author:** [@Royjan](https://discourse.processing.org/u/Royjan)\
**Replies:** 2\
**Last updated:** [August 20, 2020, 5:54am UTC](https://discourse.processing.org/t/code-issue-a-bug-that-killed-me-p5/23363 "2020-08-20T05:54:58Z")

</div>

Hello friends, I created a simple game that has an annoying bug that I can not solve / may be simple for some of you but my brain has become mashed and I can no longer think of a logical solution. So the goal in the g…

---

## [Integrate P5.js canvas into bootstrap template](https://discourse.processing.org/t/integrate-p5-js-canvas-into-bootstrap-template/23371)

<div class="topic-metadata">

**Author:** [@chanof](https://discourse.processing.org/u/chanof)\
**Replies:** 1\
**Last updated:** [August 20, 2020, 12:10am UTC](https://discourse.processing.org/t/integrate-p5-js-canvas-into-bootstrap-template/23371 "2020-08-20T00:10:52Z")

</div>

Im trying to insert a P5.js sketch inside a bootstrap div as you can see in the code below, with an empty sketch canvas it works properly, but with the sketch that I want to add I’m unable to get it into div, centered …

---

## [Translate Processing sketch into P5 issue](https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344)

<div class="topic-metadata">

**Author:** [@chanof](https://discourse.processing.org/u/chanof)\
**Replies:** 15\
**Last updated:** [August 19, 2020, 3:40pm UTC](https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344 "2020-08-19T15:40:56Z")

</div>

HI, im trying to translate this processing sketch into P5, P5 is currently unable to give me an error that I can understand. below I posted the original processing sketch, and my wild guess on p5. P5: class CubeClass …

---

## [One app sending keystrokes to another?](https://discourse.processing.org/t/one-app-sending-keystrokes-to-another/23281)

<div class="topic-metadata">

**Author:** [@ottenm](https://discourse.processing.org/u/ottenm)\
**Replies:** 2\
**Last updated:** [August 19, 2020, 2:23pm UTC](https://discourse.processing.org/t/one-app-sending-keystrokes-to-another/23281 "2020-08-19T14:23:49Z")

</div>

I need to write a p5js app that can communicate with another p5js app. It could be a copy of itself running somewhere else, or two different apps. Direct peer-to-peer would be awesome, but probably easiest to go throug…

---

## [P5.Score: Cannot read property 'start' of undefined](https://discourse.processing.org/t/p5-score-cannot-read-property-start-of-undefined/15305)

<div class="topic-metadata">

**Author:** [@m4rinos](https://discourse.processing.org/u/m4rinos)\
**Replies:** 8\
**Last updated:** [August 18, 2020, 6:25pm UTC](https://discourse.processing.org/t/p5-score-cannot-read-property-start-of-undefined/15305 "2020-08-18T18:25:53Z")

</div>

Hi, I’m new to this community and p5 so forgive me if I ask something silly, but here is my problem. I have a part with a phrase and I’m now trying to add the part to a score because I want to be able to play more parts…

---

## [CPU Optimization - Mobile & Servers: Loading Times](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280)

<div class="topic-metadata">

**Author:** [@mnoble](https://discourse.processing.org/u/mnoble)\
**Replies:** 15\
**Last updated:** [August 18, 2020, 5:30pm UTC](https://discourse.processing.org/t/cpu-optimization-mobile-servers-loading-times/23280 "2020-08-18T17:30:05Z")

</div>

Hello Forum, I am working on a series of audio visual projects that I want people to access from a variety of mobile devices. I really love using the p5js Open Processing website in full screen mode (because it is ready…

---

## [Webgl Rendering Much Slower on Desktop than Mac Pro](https://discourse.processing.org/t/webgl-rendering-much-slower-on-desktop-than-mac-pro/23339)

<div class="topic-metadata">

**Author:** [@sgebrial](https://discourse.processing.org/u/sgebrial)\
**Replies:** 0\
**Last updated:** [August 18, 2020, 5:01pm UTC](https://discourse.processing.org/t/webgl-rendering-much-slower-on-desktop-than-mac-pro/23339 "2020-08-18T17:01:55Z")

</div>

I’m working on an n-body simulation and drawing hundreds of small spheres to the screen. On my mac pro I can draw about a thousand smoothly but on my desktop with a gtx 1080 it very jittery (~5fps). Anyone know how I can…

---

## [Webcam freezing issue in Safari (iOS and OSX)](https://discourse.processing.org/t/webcam-freezing-issue-in-safari-ios-and-osx/21598)

<div class="topic-metadata">

**Author:** [@crafah](https://discourse.processing.org/u/crafah)\
**Replies:** 1\
**Last updated:** [August 18, 2020, 4:28pm UTC](https://discourse.processing.org/t/webcam-freezing-issue-in-safari-ios-and-osx/21598 "2020-08-18T16:28:12Z")

</div>

Hi, Experiencing a weird issue trying to run a facetracking sketch across platforms. In Chrome and Firefox the project works perfectly. In Safari (both desktop and mobile versions), however, the webcam sometimes refuses…

---

## [When is processing faster than p5?](https://discourse.processing.org/t/when-is-processing-faster-than-p5/23216)

<div class="topic-metadata">

**Author:** [@Hapiel](https://discourse.processing.org/u/Hapiel)\
**Replies:** 4\
**Last updated:** [August 16, 2020, 6:23pm UTC](https://discourse.processing.org/t/when-is-processing-faster-than-p5/23216 "2020-08-16T18:23:16Z")

</div>

Heya, I originally did a Processing course, and now discovered p5 which I prefer to use. Today I tried to follow this Processing tutorial in p5: https://timrodenbroeker.de/processing-tutorial-kinetic-typography-1/ It …

---

## [Tutorial: Locked Rotation with p5.easycam](https://discourse.processing.org/t/tutorial-locked-rotation-with-p5-easycam/23295)

<div class="topic-metadata">

**Author:** [@SamuelCobb](https://discourse.processing.org/u/SamuelCobb)\
**Replies:** 0\
**Last updated:** [August 16, 2020, 3:59pm UTC](https://discourse.processing.org/t/tutorial-locked-rotation-with-p5-easycam/23295 "2020-08-16T15:59:57Z")

</div>

Hey guys, I just wanted to share my experience and my newfound knowledge of easycam. This idea started when I wanted to smoothly move around a physics sim that I am working on. The freeness of the camera was slightly to…

---

## [Get() returns RGB values while the colorMode is set to HSB](https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827)

<div class="topic-metadata">

**Author:** [@papaboo](https://discourse.processing.org/u/papaboo)\
**Replies:** 7\
**Last updated:** [August 16, 2020, 1:34pm UTC](https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827 "2020-08-16T13:34:25Z")

</div>

I’ve swicthed to p5.js from Procesisng.js today (I’ll miss that dude) and already encountered a problem. get() returns an RGB value but my canvas is set to HSB mode. As far as I remember that wasn’t happening when I was…

---

## [Drawing inside the box()](https://discourse.processing.org/t/drawing-inside-the-box/23133)

<div class="topic-metadata">

**Author:** [@nokkoran](https://discourse.processing.org/u/nokkoran)\
**Replies:** 3\
**Last updated:** [August 15, 2020, 12:19am UTC](https://discourse.processing.org/t/drawing-inside-the-box/23133 "2020-08-15T00:19:08Z")

</div>

function setup() { createCanvas(400, 400, WEBGL); } function draw() { background(255); rotateX(frameCount \* 0.01); rotateY(frameCount \* 0.01); noStroke(); fill(0); box(150); } I have this code and i want…

---

## [Drawing with custom function on p5.Graphics layer](https://discourse.processing.org/t/drawing-with-custom-function-on-p5-graphics-layer/23268)

<div class="topic-metadata">

**Author:** [@Hapiel](https://discourse.processing.org/u/Hapiel)\
**Replies:** 3\
**Last updated:** [August 15, 2020, 9:36am UTC](https://discourse.processing.org/t/drawing-with-custom-function-on-p5-graphics-layer/23268 "2020-08-15T09:36:44Z")

</div>

Hiya, I wrote a function which draws a shape for me, and now I want to draw that shape onto a p5.Graphics layer. How do I do that? Normally I write myGraphics.ellipse(0,0,10); which works fine, but I can’t write: myGr…

---

## [Is the p5.js editor broken?](https://discourse.processing.org/t/is-the-p5-js-editor-broken/23209)

<div class="topic-metadata">

**Author:** [@darkglove](https://discourse.processing.org/u/darkglove)\
**Replies:** 6\
**Last updated:** [August 14, 2020, 11:38pm UTC](https://discourse.processing.org/t/is-the-p5-js-editor-broken/23209 "2020-08-14T23:38:07Z")

</div>

I can’t see anything in the preview browser on multiple browsers, same for example codes I also have a sketch embedded in a site (for ages) and that isn’t showing up either EDIT: Not paying attention to where I’m posti…

---

## [Random custom 3d model / P5js](https://discourse.processing.org/t/random-custom-3d-model-p5js/23253)

<div class="topic-metadata">

**Author:** [@HelloP5js](https://discourse.processing.org/u/HelloP5js)\
**Replies:** 0\
**Last updated:** [August 14, 2020, 1:20pm UTC](https://discourse.processing.org/t/random-custom-3d-model-p5js/23253 "2020-08-14T13:20:35Z")

</div>

Hi, I’ve been following this amazing tutorial and trying to make it work with custom 3d object. So my goal is to get random 3d objects in random locations. I’m a beginner in p5.js and I’ve spent a long time watching tu…

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

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