# p5.js

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

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

**Page:** 104

---

## [Setting socket data over draw background || scope problem?](https://discourse.processing.org/t/setting-socket-data-over-draw-background-scope-problem/6780)

<div class="topic-metadata">

**Author:** [@Honkitonkie](https://discourse.processing.org/u/Honkitonkie)\
**Replies:** 5\
**Last updated:** [December 23, 2018, 6:36pm UTC](https://discourse.processing.org/t/setting-socket-data-over-draw-background-scope-problem/6780 "2018-12-23T18:36:51Z")

</div>

Hi, I just created this account because i spent two entire afternoons trying to debug the following code: (As of now it doesn’t work (but i feel like it should)) With the risk of asking a question with an obvious answe…

---

## [BubbleSort Visualization (want to slow it down)](https://discourse.processing.org/t/bubblesort-visualization-want-to-slow-it-down/6742)

<div class="topic-metadata">

**Author:** [@Lillbre](https://discourse.processing.org/u/Lillbre)\
**Replies:** 3\
**Last updated:** [December 21, 2018, 12:23am UTC](https://discourse.processing.org/t/bubblesort-visualization-want-to-slow-it-down/6742 "2018-12-21T00:23:00Z")

</div>

I want to make a visualization of BubbleSort and make rectangles move to show the sorting. My code works “kind off” https://editor.p5js.org/Lillbre/sketches/HkkBABreN but I would love if every move could be seen more slo…

---

## [Seamlessly changing the render target from on-screen to a larger off-screen graphic](https://discourse.processing.org/t/seamlessly-changing-the-render-target-from-on-screen-to-a-larger-off-screen-graphic/6695)

<div class="topic-metadata">

**Author:** [@grege2](https://discourse.processing.org/u/grege2)\
**Replies:** 1\
**Last updated:** [December 18, 2018, 4:20am UTC](https://discourse.processing.org/t/seamlessly-changing-the-render-target-from-on-screen-to-a-larger-off-screen-graphic/6695 "2018-12-18T04:20:26Z")

</div>

Hi folks, Summary: I’d like to change my p5.js rendering target (ie. destination, or graphics buffer) from the on-screen physical window, to an off-screen graphics buffer, by just using some “setRenderTarget()” call, bu…

---

## [Fuzziness when switching sketches](https://discourse.processing.org/t/fuzziness-when-switching-sketches/6717)

<div class="topic-metadata">

**Author:** [@Zuii](https://discourse.processing.org/u/Zuii)\
**Replies:** 2\
**Last updated:** [December 18, 2018, 3:17am UTC](https://discourse.processing.org/t/fuzziness-when-switching-sketches/6717 "2018-12-18T03:17:59Z")

</div>

Hello, I working on a kind of master sketch that can switch between sketches easily. The functionality is working great but for some reason when I switch to a different sketch it gets kinda fuzzy. My program is setup l…

---

## [Gradient color in Line](https://discourse.processing.org/t/gradient-color-in-line/6694)

<div class="topic-metadata">

**Author:** [@noob](https://discourse.processing.org/u/noob)\
**Replies:** 3\
**Last updated:** [December 18, 2018, 3:02am UTC](https://discourse.processing.org/t/gradient-color-in-line/6694 "2018-12-18T03:02:05Z")

</div>

Hello! It’s me again :blush: with the beginner question. So I was playing around with lines as you can see in the code below and I want to make the gradient color from black to white in the lines to give effect of depth…

---

## [Help with instance mode?](https://discourse.processing.org/t/help-with-instance-mode/6647)

<div class="topic-metadata">

**Author:** [@metrocode](https://discourse.processing.org/u/metrocode)\
**Replies:** 1\
**Last updated:** [December 16, 2018, 3:35am UTC](https://discourse.processing.org/t/help-with-instance-mode/6647 "2018-12-16T03:35:04Z")

</div>

Hello, I am having trouble using instance mode. I would like to convert this code for a mini game into instance mode so that I can reference it in a bigger game file that I am coding. I am not sure if I am using the ins…

---

## [Random color but static](https://discourse.processing.org/t/random-color-but-static/6623)

<div class="topic-metadata">

**Author:** [@noob](https://discourse.processing.org/u/noob)\
**Replies:** 3\
**Last updated:** [December 15, 2018, 11:47am UTC](https://discourse.processing.org/t/random-color-but-static/6623 "2018-12-15T11:47:29Z")

</div>

I am just beginner and I am doing little bit exercise with p5.js. So please bear with me if my code is such a mess. I made multiple gameboy with random flickering screen and now I want to make another random color for t…

---

## [\[SOLVED\] When Maximized, the 'background()' is slightly too large](https://discourse.processing.org/t/solved-when-maximized-the-background-is-slightly-too-large/6602)

<div class="topic-metadata">

**Author:** [@prcoy](https://discourse.processing.org/u/prcoy)\
**Replies:** 4\
**Last updated:** [December 14, 2018, 10:53pm UTC](https://discourse.processing.org/t/solved-when-maximized-the-background-is-slightly-too-large/6602 "2018-12-14T22:53:45Z")

</div>

I making a clock. I hope to make it a screen saver (someday). // Problem: When Maximized, the ‘background()’ is slightly too large for the // screen and I get unwanted scrollbars. // When in fullscreen, I get no scrol…

---

## [New coder- added background to flappy bird game now doesn't work](https://discourse.processing.org/t/new-coder-added-background-to-flappy-bird-game-now-doesnt-work/6552)

<div class="topic-metadata">

**Author:** [@ryan19](https://discourse.processing.org/u/ryan19)\
**Replies:** 3\
**Last updated:** [December 14, 2018, 1:46am UTC](https://discourse.processing.org/t/new-coder-added-background-to-flappy-bird-game-now-doesnt-work/6552 "2018-12-14T01:46:38Z")

</div>

Please help this is my original code and when the user claps the bird goes up and down: Once we added a background image as the background the code stopped working: PLEASE HELP //Good Code: var bird; var pipes = \[\]; …

---

## [Timing a class to reveal words](https://discourse.processing.org/t/timing-a-class-to-reveal-words/6556)

<div class="topic-metadata">

**Author:** [@jamiehamill](https://discourse.processing.org/u/jamiehamill)\
**Replies:** 2\
**Last updated:** [December 12, 2018, 11:48pm UTC](https://discourse.processing.org/t/timing-a-class-to-reveal-words/6556 "2018-12-12T23:48:55Z")

</div>

hey all! my question is likely to be super confusing as it’s difficult to explain and this is my first time using this forum, but I was wondering how I can time a class (that controls my text) to send out words slowly ov…

---

## [Help with P5.js and ML5.js](https://discourse.processing.org/t/help-with-p5-js-and-ml5-js/6446)

<div class="topic-metadata">

**Author:** [@zack](https://discourse.processing.org/u/zack)\
**Replies:** 1\
**Last updated:** [December 12, 2018, 2:03am UTC](https://discourse.processing.org/t/help-with-p5-js-and-ml5-js/6446 "2018-12-12T02:03:12Z")

</div>

Hello Community :slight\_smile: I’ve been playing with p5.js and the new ml5.js machine learning library. I’m having an issue using a p5 image as an input for the ml5 style transfer function. Maybe someone can help me fi…

---

## [Translate p5js code to processing code?](https://discourse.processing.org/t/translate-p5js-code-to-processing-code/6505)

<div class="topic-metadata">

**Author:** [@Anaibuk](https://discourse.processing.org/u/Anaibuk)\
**Replies:** 8\
**Last updated:** [December 11, 2018, 11:49pm UTC](https://discourse.processing.org/t/translate-p5js-code-to-processing-code/6505 "2018-12-11T23:49:58Z")

</div>

Hello everyone, I’m just having a wild crash curse of processing (generative Design) at university. As we haven’t enough time, we are just learning to code with processing and not with p5js. Unfortunaly most of the exam…

---

## [Pixelgaps using scale on a 2D tile grid](https://discourse.processing.org/t/pixelgaps-using-scale-on-a-2d-tile-grid/6420)

<div class="topic-metadata">

**Author:** [@tony32](https://discourse.processing.org/u/tony32)\
**Replies:** 4\
**Last updated:** [December 8, 2018, 3:11pm UTC](https://discourse.processing.org/t/pixelgaps-using-scale-on-a-2d-tile-grid/6420 "2018-12-08T15:11:58Z")

</div>

Hey guys. I have an annoying issue on my project im working on. I’m generating a bunch of tiles, just with basic rects at a size of 32x32 pixels and putting them inside an array of arrays. Like Array\[0\]\[5\] would be ro…

---

## [Re-initilizing instance of p5.js](https://discourse.processing.org/t/re-initilizing-instance-of-p5-js/6384)

<div class="topic-metadata">

**Author:** [@ffd8](https://discourse.processing.org/u/ffd8)\
**Replies:** 4\
**Last updated:** [December 7, 2018, 12:31am UTC](https://discourse.processing.org/t/re-initilizing-instance-of-p5-js/6384 "2018-12-07T00:31:05Z")

</div>

I’m working on a special use of p5.js, for hot-swapping sketches – this involves dynamically embedding a script with a new setup()/draw() which overrides the initial one. It’s working quite well, however I run into two m…

---

## [Objects becoming children of other objects. How do I make them completely separate?](https://discourse.processing.org/t/objects-becoming-children-of-other-objects-how-do-i-make-them-completely-separate/6346)

<div class="topic-metadata">

**Author:** [@castaway](https://discourse.processing.org/u/castaway)\
**Replies:** 2\
**Last updated:** [December 6, 2018, 9:13pm UTC](https://discourse.processing.org/t/objects-becoming-children-of-other-objects-how-do-i-make-them-completely-separate/6346 "2018-12-06T21:13:29Z")

</div>

Greetings, I am trying to create a small animation where squares scale down at different speeds from different positions to eventually stop at a specific size and create a mosaic made of several squares. I wrote differe…

---

## [Load with loadStrings() a text file saved with saveStrings()?](https://discourse.processing.org/t/load-with-loadstrings-a-text-file-saved-with-savestrings/6009)

<div class="topic-metadata">

**Author:** [@Laurent](https://discourse.processing.org/u/Laurent)\
**Replies:** 11\
**Last updated:** [December 6, 2018, 8:42pm UTC](https://discourse.processing.org/t/load-with-loadstrings-a-text-file-saved-with-savestrings/6009 "2018-12-06T20:42:37Z")

</div>

Hi everyone. I’d like to write two demonstration codes for my students that makes the following operations: #1 save a list of strings into a text file with saveStrings() #2 open this text file and read/transfer the sav…

---

## [I'm trying to convert a fractal tree program from processing to p5js](https://discourse.processing.org/t/im-trying-to-convert-a-fractal-tree-program-from-processing-to-p5js/6336)

<div class="topic-metadata">

**Author:** [@Sunnylimenoid](https://discourse.processing.org/u/Sunnylimenoid)\
**Replies:** 3\
**Last updated:** [December 5, 2018, 10:55pm UTC](https://discourse.processing.org/t/im-trying-to-convert-a-fractal-tree-program-from-processing-to-p5js/6336 "2018-12-05T22:55:41Z")

</div>

Hello, I’m quite new to both processing and p5.js. I am experimenting with this demo on the processing site https://processing.org/examples/tree.html. I got it working in processing and want to publish it on my blog, but…

---

## [How do I load multiple JSON urls?](https://discourse.processing.org/t/how-do-i-load-multiple-json-urls/6150)

<div class="topic-metadata">

**Author:** [@salazarspanish](https://discourse.processing.org/u/salazarspanish)\
**Replies:** 15\
**Last updated:** [December 5, 2018, 6:45pm UTC](https://discourse.processing.org/t/how-do-i-load-multiple-json-urls/6150 "2018-12-05T18:45:47Z")

</div>

Hello! I was able to load one JSON url from Yahoo Weather, but now I am having trouble loading multiple urls. I tried searching my question on stack overflow, but the posts I found mentioned one JSON url, not several. Al…

---

## [Need help from converting this p5.js/JavaScript program to Processing](https://discourse.processing.org/t/need-help-from-converting-this-p5-js-javascript-program-to-processing/6287)

<div class="topic-metadata">

**Author:** [@charmypatel](https://discourse.processing.org/u/charmypatel)\
**Replies:** 5\
**Last updated:** [December 5, 2018, 2:20pm UTC](https://discourse.processing.org/t/need-help-from-converting-this-p5-js-javascript-program-to-processing/6287 "2018-12-05T14:20:58Z")

</div>

I want to do this same exact thing and needed help converting this p5.js program to processing code. I’m not sure how to do that. Any suggestions? Or if anyone knows where I can find a simpler fireworks example that I ca…

---

## [Script error. (: line 0)](https://discourse.processing.org/t/script-error-line-0/6294)

<div class="topic-metadata">

**Author:** [@billythemusical](https://discourse.processing.org/u/billythemusical)\
**Replies:** 3\
**Last updated:** [December 5, 2018, 7:32am UTC](https://discourse.processing.org/t/script-error-line-0/6294 "2018-12-05T07:32:16Z")

</div>

Hi - this sketch worked yesterday, and now I get: Script error. (: line 0) The sketch uses a web cam, FYI. I noticed Chrome has just updated today (Dec 4 2018) to “Version 71.0.3578.80 (Official Build) (64-bit)”. I a…

---

## [Pixel Array Will Not Work](https://discourse.processing.org/t/pixel-array-will-not-work/6295)

<div class="topic-metadata">

**Author:** [@bschofield](https://discourse.processing.org/u/bschofield)\
**Replies:** 2\
**Last updated:** [December 4, 2018, 8:21pm UTC](https://discourse.processing.org/t/pixel-array-will-not-work/6295 "2018-12-04T20:21:01Z")

</div>

We want this game to count the pixels of the red and the blue strokes to see who has more pixels at the end of the game and then display who wins. But for some reason we can only get it to say Blue Wins and it is now l…

---

## [Noise generation, aka clouds, is really slow and heavy](https://discourse.processing.org/t/noise-generation-aka-clouds-is-really-slow-and-heavy/6163)

<div class="topic-metadata">

**Author:** [@michelangelo](https://discourse.processing.org/u/michelangelo)\
**Replies:** 9\
**Last updated:** [December 3, 2018, 9:08pm UTC](https://discourse.processing.org/t/noise-generation-aka-clouds-is-really-slow-and-heavy/6163 "2018-12-03T21:08:17Z")

</div>

Hello there, I have been working on this small program that I would like to use as a fullscreen background. However, it already is really heavy. Is there a way to fix that in my code or I just have to think of another w…

---

## [Auto-updating and downloading libraries](https://discourse.processing.org/t/auto-updating-and-downloading-libraries/6008)

<div class="topic-metadata">

**Author:** [@ThatIsAPseudo](https://discourse.processing.org/u/ThatIsAPseudo)\
**Replies:** 1\
**Last updated:** [December 3, 2018, 1:19pm UTC](https://discourse.processing.org/t/auto-updating-and-downloading-libraries/6008 "2018-12-03T13:19:51Z")

</div>

Hello there ! I was wondering if that is possible to ask index.html to look for the libraries online through the CDN, and if these are not available (because of server connexion failure, airplane mode,…) it uses local l…

---

## [Shift perspective on a 2D sketch? or if not posible, easily convert to 3D?](https://discourse.processing.org/t/shift-perspective-on-a-2d-sketch-or-if-not-posible-easily-convert-to-3d/5954)

<div class="topic-metadata">

**Author:** [@gio](https://discourse.processing.org/u/gio)\
**Replies:** 2\
**Last updated:** [December 2, 2018, 6:53pm UTC](https://discourse.processing.org/t/shift-perspective-on-a-2d-sketch-or-if-not-posible-easily-convert-to-3d/5954 "2018-12-02T18:53:35Z")

</div>

Hi, I got this 2s array grid of sliding circles: https://codepen.io/giorgiomartini/pen/MzGmwW?editors=0010 Its inspired by this poster: as u can see in the poster, it has perspecive… is there a way to tilt/shift …

---

## [How to get pitch of human voice](https://discourse.processing.org/t/how-to-get-pitch-of-human-voice/5833)

<div class="topic-metadata">

**Author:** [@emma](https://discourse.processing.org/u/emma)\
**Replies:** 5\
**Last updated:** [December 2, 2018, 7:30am UTC](https://discourse.processing.org/t/how-to-get-pitch-of-human-voice/5833 "2018-12-02T07:30:58Z")

</div>

I’m trying to make a sketch that find the pitch of a human voice (speaking or singing). I thought I was headed in the right direction, but I’m getting stuck. Here is my strategy: Loop through all the frequencies in th…

---

## [Displaying effect unwanted](https://discourse.processing.org/t/displaying-effect-unwanted/6129)

<div class="topic-metadata">

**Author:** [@Pr0tonX](https://discourse.processing.org/u/Pr0tonX)\
**Replies:** 1\
**Last updated:** [December 1, 2018, 3:37pm UTC](https://discourse.processing.org/t/displaying-effect-unwanted/6129 "2018-12-01T15:37:26Z")

</div>

Hello, I’m trying to remake the concept of the Patatap of jonobr1 ( see https://www.patatap.com/) wich is pretty cool : 1 song 1 shape according to the song, launched by your keyboard. So I’m stuck on only one animatio…

---

## [Applying two forces to particles](https://discourse.processing.org/t/applying-two-forces-to-particles/6127)

<div class="topic-metadata">

**Author:** [@jmean](https://discourse.processing.org/u/jmean)\
**Replies:** 1\
**Last updated:** [December 1, 2018, 1:51am UTC](https://discourse.processing.org/t/applying-two-forces-to-particles/6127 "2018-12-01T01:51:31Z")

</div>

Hi, I’m writing a sketch where I want many small particles to be attracted to large central particle, this is working. However I also want all small particles to repel from each other at the same time. I’ve tried a co…

---

## [How can I make my game create a new ball and/or restart the code?](https://discourse.processing.org/t/how-can-i-make-my-game-create-a-new-ball-and-or-restart-the-code/6111)

<div class="topic-metadata">

**Author:** [@BLy](https://discourse.processing.org/u/BLy)\
**Replies:** 6\
**Last updated:** [December 1, 2018, 12:39am UTC](https://discourse.processing.org/t/how-can-i-make-my-game-create-a-new-ball-and-or-restart-the-code/6111 "2018-12-01T00:39:17Z")

</div>

I am currently trying to make it so when a button is clicked, it will create a new ball. I’m also trying to have another button that would completely restart the game. Can someone help me out please? My code is here: va…

---

## [How to create the code of the following video effect?](https://discourse.processing.org/t/how-to-create-the-code-of-the-following-video-effect/6113)

<div class="topic-metadata">

**Author:** [@Malvan](https://discourse.processing.org/u/Malvan)\
**Replies:** 1\
**Last updated:** [November 30, 2018, 4:11pm UTC](https://discourse.processing.org/t/how-to-create-the-code-of-the-following-video-effect/6113 "2018-11-30T16:11:13Z")

</div>

Hello there! I was searching through the internet to find anything useful regarding to one of my school projects. I want to create something like this: https://vimeo.com/8218843 The problem is, I don’t really know wher…

---

## [Breaking out of For Loop when mouse is depressed?](https://discourse.processing.org/t/breaking-out-of-for-loop-when-mouse-is-depressed/6071)

<div class="topic-metadata">

**Author:** [@DarkEco](https://discourse.processing.org/u/DarkEco)\
**Replies:** 2\
**Last updated:** [November 30, 2018, 1:20am UTC](https://discourse.processing.org/t/breaking-out-of-for-loop-when-mouse-is-depressed/6071 "2018-11-30T01:20:15Z")

</div>

Hi, i’m quite new to coding in general and having a really hard time with this. Currently my loop is running from 0-1000 in a single click, but i need it to break out of the loop when i let go of the mouse. I’m guessing …

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

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