# p5.js

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

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

**Page:** 41

---

## [Display Issue - Same sketch displays diff on diff computers](https://discourse.processing.org/t/display-issue-same-sketch-displays-diff-on-diff-computers/31305)

<div class="topic-metadata">

**Author:** [@BigBigRed](https://discourse.processing.org/u/BigBigRed)\
**Replies:** 6\
**Last updated:** [July 17, 2021, 10:10pm UTC](https://discourse.processing.org/t/display-issue-same-sketch-displays-diff-on-diff-computers/31305 "2021-07-17T22:10:58Z")

</div>

I have a p5js sketch that displays differently on my desktop computer than on my laptop computer. The problem apparently comes from from the graphic(s) named Mandlebrot. On the laptop computer, the image for mandleb…

---

## [Breathing Data (how to determine & calculate inhale/exhale duration)](https://discourse.processing.org/t/breathing-data-how-to-determine-calculate-inhale-exhale-duration/31278)

<div class="topic-metadata">

**Author:** [@Nick76](https://discourse.processing.org/u/Nick76)\
**Replies:** 2\
**Last updated:** [July 17, 2021, 11:38am UTC](https://discourse.processing.org/t/breathing-data-how-to-determine-calculate-inhale-exhale-duration/31278 "2021-07-17T11:38:17Z")

</div>

Hi everybody, I’m currently working on a project in which I use a breath-belt (arduino+stretch sensor attached around the chest) to capture the breathing patterns of a user. The data is transferred and integrated into t…

---

## [Drawing images with the image function seems to be very slow](https://discourse.processing.org/t/drawing-images-with-the-image-function-seems-to-be-very-slow/31031)

<div class="topic-metadata">

**Author:** [@modusponens](https://discourse.processing.org/u/modusponens)\
**Replies:** 7\
**Last updated:** [July 15, 2021, 8:26pm UTC](https://discourse.processing.org/t/drawing-images-with-the-image-function-seems-to-be-very-slow/31031 "2021-07-15T20:26:18Z")

</div>

I’m trying to write a game engine using p5, but I’ve hit a huge snag: unless I’m doing something wrong (which is definitely possible), the image function seems really slow. If I call it even just about 40 or 50 times per…

---

## [Jumping from Processing to p5.js... whaaa?](https://discourse.processing.org/t/jumping-from-processing-to-p5-js-whaaa/31249)

<div class="topic-metadata">

**Author:** [@Eamoex](https://discourse.processing.org/u/Eamoex)\
**Replies:** 2\
**Last updated:** [July 15, 2021, 6:09am UTC](https://discourse.processing.org/t/jumping-from-processing-to-p5-js-whaaa/31249 "2021-07-15T06:09:37Z")

</div>

Hi, getting into Javascript (p5.js) from Processing to embed sketches on my website. Right from the start there are two things I don’t get. variables have no declared type? arrays have no declared length? Here is a p…

---

## [Fill an imagined ellipse with dots](https://discourse.processing.org/t/fill-an-imagined-ellipse-with-dots/31221)

<div class="topic-metadata">

**Author:** [@k5221](https://discourse.processing.org/u/k5221)\
**Replies:** 5\
**Last updated:** [July 15, 2021, 8:44am UTC](https://discourse.processing.org/t/fill-an-imagined-ellipse-with-dots/31221 "2021-07-15T08:44:54Z")

</div>

Hi, what I would like to do is fill an imagined ellipse (x, y, w, h) with tiny dots whose size is specified by “dotSize” of the “drawHead” function. But I struggle coming up a way to fit dots inside an ellipse (so the nu…

---

## [Can't use math functions inside class constructor](https://discourse.processing.org/t/cant-use-math-functions-inside-class-constructor/31251)

<div class="topic-metadata">

**Author:** [@seanc4s](https://discourse.processing.org/u/seanc4s)\
**Replies:** 4\
**Last updated:** [July 14, 2021, 11:16pm UTC](https://discourse.processing.org/t/cant-use-math-functions-inside-class-constructor/31251 "2021-07-14T23:16:13Z")

</div>

Can’t use math functions inside class constructor, and some other functions like print(“Hi”) for example. I don’t mind, but it kinda makes my code look ugly having to use JavaScript Math.random() for example. Which has …

---

## [Randomly select file to preload (p5.js)](https://discourse.processing.org/t/randomly-select-file-to-preload-p5-js/31148)

<div class="topic-metadata">

**Author:** [@fleshcircuit](https://discourse.processing.org/u/fleshcircuit)\
**Replies:** 9\
**Last updated:** [July 14, 2021, 12:46pm UTC](https://discourse.processing.org/t/randomly-select-file-to-preload-p5-js/31148 "2021-07-14T12:46:31Z")

</div>

I am working on a project where I am using data from a json file, but I am wondering if it is possible to randomly select a file from the data folder for a sketch to use. I don’t want to load all the files, since I fear …

---

## [Preview of p5.js Web Editor down or moved to new address](https://discourse.processing.org/t/preview-of-p5-js-web-editor-down-or-moved-to-new-address/31226)

<div class="topic-metadata">

**Author:** [@nikko](https://discourse.processing.org/u/nikko)\
**Replies:** 1\
**Last updated:** [July 13, 2021, 10:39pm UTC](https://discourse.processing.org/t/preview-of-p5-js-web-editor-down-or-moved-to-new-address/31226 "2021-07-13T22:39:17Z")

</div>

Hi all, Since I am an absolute beginner who just created my account, please remove my post if it is not relevant or belongs to another section or the forum. I just noticed a few minutes ago that the Preview in the p5.j…

---

## [Draw() overlay shapes on the canvas](https://discourse.processing.org/t/draw-overlay-shapes-on-the-canvas/31222)

<div class="topic-metadata">

**Author:** [@k5221](https://discourse.processing.org/u/k5221)\
**Replies:** 1\
**Last updated:** [July 13, 2021, 7:08am UTC](https://discourse.processing.org/t/draw-overlay-shapes-on-the-canvas/31222 "2021-07-13T07:08:12Z")

</div>

Hi, I’m writing a code to call another custom render function I created inside the draw() to render shapes (which is essentially a bunch of ellipses) on the screen. But, it draws shapes on top of each other and doesn’t r…

---

## [Mitigating Periodicity in Perlin Noise](https://discourse.processing.org/t/mitigating-periodicity-in-perlin-noise/31211)

<div class="topic-metadata">

**Author:** [@javagar](https://discourse.processing.org/u/javagar)\
**Replies:** 4\
**Last updated:** [July 13, 2021, 6:13am UTC](https://discourse.processing.org/t/mitigating-periodicity-in-perlin-noise/31211 "2021-07-13T06:13:24Z")

</div>

I’m working on a Racing Eggs! animation, wherein four Egg objects race across the canvas from left to right. They each speed up and slow down independently of each other. When an Egg reaches the right edge of the canvas,…

---

## [Get a 3d cube made of cubes to expand from the center](https://discourse.processing.org/t/get-a-3d-cube-made-of-cubes-to-expand-from-the-center/31220)

<div class="topic-metadata">

**Author:** [@LuluLuna](https://discourse.processing.org/u/LuluLuna)\
**Replies:** 1\
**Last updated:** [July 13, 2021, 1:25am UTC](https://discourse.processing.org/t/get-a-3d-cube-made-of-cubes-to-expand-from-the-center/31220 "2021-07-13T01:25:41Z")

</div>

Hello, I made this sketch Link to sketch as you can see its a cube made of smaller cubes that expand and retract using sin. My problem is that the smaller cubes expand and retract from the corner cube and not from the…

---

## [Web editor jumps around when errors occur while im writing classes](https://discourse.processing.org/t/web-editor-jumps-around-when-errors-occur-while-im-writing-classes/31217)

<div class="topic-metadata">

**Author:** [@CattoKing](https://discourse.processing.org/u/CattoKing)\
**Replies:** 1\
**Last updated:** [July 13, 2021, 12:55am UTC](https://discourse.processing.org/t/web-editor-jumps-around-when-errors-occur-while-im-writing-classes/31217 "2021-07-13T00:55:43Z")

</div>

I don’t really know where to post this, but there is something i am REALLY annoyed by in the p5.js web editor. Whenever i am writing a class or extending a class, i have to pause to think of a name for the class (it hap…

---

## [P5js blendmode is so strange](https://discourse.processing.org/t/p5js-blendmode-is-so-strange/30958)

<div class="topic-metadata">

**Author:** [@yang](https://discourse.processing.org/u/yang)\
**Replies:** 6\
**Last updated:** [July 12, 2021, 5:02pm UTC](https://discourse.processing.org/t/p5js-blendmode-is-so-strange/30958 "2021-07-12T17:02:00Z")

</div>

Hello guys,I’m trying to make an animation of rains flowing down a window, but there’s still some color left that doesn’t blend with the background. So I look up the blendMode() reference, and find a fomula for BLEND C…

---

## [Drawing a flower-like shape](https://discourse.processing.org/t/drawing-a-flower-like-shape/31200)

<div class="topic-metadata">

**Author:** [@k5221](https://discourse.processing.org/u/k5221)\
**Replies:** 3\
**Last updated:** [July 12, 2021, 8:54am UTC](https://discourse.processing.org/t/drawing-a-flower-like-shape/31200 "2021-07-12T08:54:53Z")

</div>

Hi, I want to draw shapes like this. The function called “seed1” is supposed to take care of one of the curvy triangles, but when I call this function within the draw(), the second and third triangles look smashed (ma…

---

## [Get() returns an empty pixels array](https://discourse.processing.org/t/get-returns-an-empty-pixels-array/31132)

<div class="topic-metadata">

**Author:** [@k5221](https://discourse.processing.org/u/k5221)\
**Replies:** 3\
**Last updated:** [July 11, 2021, 8:13am UTC](https://discourse.processing.org/t/get-returns-an-empty-pixels-array/31132 "2021-07-11T08:13:52Z")

</div>

Hi, I want to show the cropped picture created by shuffling the certain portion of the original videocam image. “capture.get()” function in draw() works correctly, but because the returning object has an empty array as t…

---

## [Clone canvas to p5 creategraphics()](https://discourse.processing.org/t/clone-canvas-to-p5-creategraphics/31142)

<div class="topic-metadata">

**Author:** [@atagger](https://discourse.processing.org/u/atagger)\
**Replies:** 2\
**Last updated:** [July 9, 2021, 8:09pm UTC](https://discourse.processing.org/t/clone-canvas-to-p5-creategraphics/31142 "2021-07-09T20:09:14Z")

</div>

Is there a way to clone the entire p5 canvas to creategraphics? I’m trying to render a SVG using the p5.js-svg library, but I don’t want to set the entire canvas renderer to “SVG”, because I only need the output to happe…

---

## [Frame count delay in showing button](https://discourse.processing.org/t/frame-count-delay-in-showing-button/31116)

<div class="topic-metadata">

**Author:** [@fleshcircuit](https://discourse.processing.org/u/fleshcircuit)\
**Replies:** 2\
**Last updated:** [July 9, 2021, 7:04am UTC](https://discourse.processing.org/t/frame-count-delay-in-showing-button/31116 "2021-07-09T07:04:00Z")

</div>

Hello, I would like to make a button appear after a delay using frame count. When I put the button in the setup, it appears at the bottom of the screen and only moves to correct place later. let phrase = \['Time' ,'is' …

---

## [ICan you change 'Page Unresponsive' time setting?](https://discourse.processing.org/t/ican-you-change-page-unresponsive-time-setting/31105)

<div class="topic-metadata">

**Author:** [@BigBigRed](https://discourse.processing.org/u/BigBigRed)\
**Replies:** 2\
**Last updated:** [July 7, 2021, 10:58pm UTC](https://discourse.processing.org/t/ican-you-change-page-unresponsive-time-setting/31105 "2021-07-07T22:58:06Z")

</div>

I have an idea that I am trying to implement in a sketch. so I am running a loop to calculate the value of each pixel in a 300 \* 300 canvas. So I get the ‘Page Unresponsive: Wait or Cancel’ pop up before the sketch draw…

---

## [HELP : can´t remove sliders from home page](https://discourse.processing.org/t/help-can-t-remove-sliders-from-home-page/31072)

<div class="topic-metadata">

**Author:** [@axelen](https://discourse.processing.org/u/axelen)\
**Replies:** 2\
**Last updated:** [July 7, 2021, 8:04pm UTC](https://discourse.processing.org/t/help-can-t-remove-sliders-from-home-page/31072 "2021-07-07T20:04:29Z")

</div>

I can’t remove sliders from the home page. They should only be visible and working when you press “Start Mixing”. Help please!! Thanks! let myFont let relleno let data let r let b let g let ariana let billie let…

---

## [How can I rename, annotate name or save to sub-directory images in a folder following classification?](https://discourse.processing.org/t/how-can-i-rename-annotate-name-or-save-to-sub-directory-images-in-a-folder-following-classification/31100)

<div class="topic-metadata">

**Author:** [@Tegan](https://discourse.processing.org/u/Tegan)\
**Replies:** 2\
**Last updated:** [July 7, 2021, 9:38am UTC](https://discourse.processing.org/t/how-can-i-rename-annotate-name-or-save-to-sub-directory-images-in-a-folder-following-classification/31100 "2021-07-07T09:38:37Z")

</div>

I am running a basic image classification model (trained on the teachable machine) but now want to be able to annotate the file names or move them to a sub directory based on the classification. I would prefer not to cop…

---

## [Creating a grid with objects that store their index number (X and Y)](https://discourse.processing.org/t/creating-a-grid-with-objects-that-store-their-index-number-x-and-y/31094)

<div class="topic-metadata">

**Author:** [@rkdnson](https://discourse.processing.org/u/rkdnson)\
**Replies:** 4\
**Last updated:** [July 6, 2021, 8:55pm UTC](https://discourse.processing.org/t/creating-a-grid-with-objects-that-store-their-index-number-x-and-y/31094 "2021-07-06T20:55:01Z")

</div>

Hello everyone, coming back after a long hiatus of not coding and my mind is a bit stumped. I am revisiting an old project so my brain keeps going back to my previous solutions even though I know that wasn’t the best way…

---

## [Help code \_ Climate Clock - Countdown events](https://discourse.processing.org/t/help-code-climate-clock-countdown-events/31070)

<div class="topic-metadata">

**Author:** [@HVK370](https://discourse.processing.org/u/HVK370)\
**Replies:** 1\
**Last updated:** [July 5, 2021, 4:32pm UTC](https://discourse.processing.org/t/help-code-climate-clock-countdown-events/31070 "2021-07-05T16:32:13Z")

</div>

Hello p5js community! This is my first code, sorry for that. the result should be YRS: Y Day: DDD hh: mm: ss such as https://climateclock.world I wrote this code but the days calculation doesn’t work. can you help me…

---

## [Help in creating a Graph Illustration](https://discourse.processing.org/t/help-in-creating-a-graph-illustration/31011)

<div class="topic-metadata">

**Author:** [@clermagic224](https://discourse.processing.org/u/clermagic224)\
**Replies:** 3\
**Last updated:** [July 4, 2021, 5:26pm UTC](https://discourse.processing.org/t/help-in-creating-a-graph-illustration/31011 "2021-07-04T17:26:57Z")

</div>

Hello p5js community! I’m trying to use p5js to build a network map and was wondering whether it is possible to build something like this? What I’ve in mind is using an object instance to represent each ball. And sto…

---

## [P5.js unit testing with Jest](https://discourse.processing.org/t/p5-js-unit-testing-with-jest/2638)

<div class="topic-metadata">

**Author:** [@kabatwa](https://discourse.processing.org/u/kabatwa)\
**Replies:** 6\
**Last updated:** [July 4, 2021, 11:48am UTC](https://discourse.processing.org/t/p5-js-unit-testing-with-jest/2638 "2021-07-04T11:48:04Z")

</div>

Hello, I’m trying to get Jest setup with p5.js. I’ve managed to get it all working with npm and able to run some basic unit tests however I’m having an issue when Jest hits a piece of p5 code. I have a sketch.js file w…

---

## [How can I make 90 degree intersections/angles more arched?](https://discourse.processing.org/t/how-can-i-make-90-degree-intersections-angles-more-arched/31010)

<div class="topic-metadata">

**Author:** [@alt](https://discourse.processing.org/u/alt)\
**Replies:** 12\
**Last updated:** [July 2, 2021, 2:59pm UTC](https://discourse.processing.org/t/how-can-i-make-90-degree-intersections-angles-more-arched/31010 "2021-07-02T14:59:22Z")

</div>

Something like this I mean: unknown.png (discordapp.com) How angles look in my code right now: unknown.png (discordapp.com) I know there’s the arc() function, but I’m not sure if that’s what I’m looking for. My code…

---

## [Can you extract the seed from randomly generated perlin noise?](https://discourse.processing.org/t/can-you-extract-the-seed-from-randomly-generated-perlin-noise/31023)

<div class="topic-metadata">

**Author:** [@TonyG](https://discourse.processing.org/u/TonyG)\
**Replies:** 4\
**Last updated:** [July 3, 2021, 11:21am UTC](https://discourse.processing.org/t/can-you-extract-the-seed-from-randomly-generated-perlin-noise/31023 "2021-07-03T11:21:59Z")

</div>

Can you get the seed from a randomly generated perlin noise graph?

---

## [403 error and sound files](https://discourse.processing.org/t/403-error-and-sound-files/31007)

<div class="topic-metadata">

**Author:** [@quargsgreene](https://discourse.processing.org/u/quargsgreene)\
**Replies:** 3\
**Last updated:** [July 3, 2021, 2:33am UTC](https://discourse.processing.org/t/403-error-and-sound-files/31007 "2021-07-03T02:33:37Z")

</div>

I was trying to add a sound file to a sketch on Open Processing and it started throwing a 403 error when I tried to trigger the sound. The files are all uploaded to the site and do not have to be accessed locally, so I w…

---

## [Splitting a text into separate words while maintaining linebreaks](https://discourse.processing.org/t/splitting-a-text-into-separate-words-while-maintaining-linebreaks/31019)

<div class="topic-metadata">

**Author:** [@AndreasRef](https://discourse.processing.org/u/AndreasRef)\
**Replies:** 2\
**Last updated:** [July 3, 2021, 1:00am UTC](https://discourse.processing.org/t/splitting-a-text-into-separate-words-while-maintaining-linebreaks/31019 "2021-07-03T01:00:02Z")

</div>

Hi I have a string of text that contains linebreaks (\\n). I want to make one word at a time appear every time I press the mouse. I can do that, however, I have an issue maintaining the linebreaks as they seem to get los…

---

## [Why the rectMode(CENTER) doesn't work for me?](https://discourse.processing.org/t/why-the-rectmode-center-doesnt-work-for-me/31009)

<div class="topic-metadata">

**Author:** [@jexilo](https://discourse.processing.org/u/jexilo)\
**Replies:** 6\
**Last updated:** [July 2, 2021, 10:50am UTC](https://discourse.processing.org/t/why-the-rectmode-center-doesnt-work-for-me/31009 "2021-07-02T10:50:40Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I followed the tutorial and try to have my rectangle in the center but why it’s still not in the center?

---

## [musicXML importing](https://discourse.processing.org/t/musicxml-importing/30742)

<div class="topic-metadata">

**Author:** [@patricio1979](https://discourse.processing.org/u/patricio1979)\
**Replies:** 3\
**Last updated:** [July 1, 2021, 1:44pm UTC](https://discourse.processing.org/t/musicxml-importing/30742 "2021-07-01T13:44:49Z")

</div>

Hello, I need to import a musicXML file into p5js por parsing I found this post https://forum.processing.org/two/discussion/22417/a-couple-of-processing-powered-music-vids Do you have any hints for doing this?

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

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