# p5.js

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

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

**Page:** 80

---

## [ml5.js and error with D3D Shaders](https://discourse.processing.org/t/ml5-js-and-error-with-d3d-shaders/17027)

<div class="topic-metadata">

**Author:** [@lobo](https://discourse.processing.org/u/lobo)\
**Replies:** 1\
**Last updated:** [January 22, 2020, 11:26pm UTC](https://discourse.processing.org/t/ml5-js-and-error-with-d3d-shaders/17027 "2020-01-22T23:26:57Z")

</div>

Hi, I’ve got several Thinkpads T420 in my classroom with Intel 3000 graphic card, and exactly the same p5js example make error Failed to create D3D Shaders on some of them, but only on some! Not on all. Why? My code: h…

---

## [Surely there has to be a better way to do this](https://discourse.processing.org/t/surely-there-has-to-be-a-better-way-to-do-this/17246)

<div class="topic-metadata">

**Author:** [@ZachMcMkay](https://discourse.processing.org/u/ZachMcMkay)\
**Replies:** 2\
**Last updated:** [January 22, 2020, 5:59pm UTC](https://discourse.processing.org/t/surely-there-has-to-be-a-better-way-to-do-this/17246 "2020-01-22T17:59:17Z")

</div>

What i wanted to do was take an array of integers and get all permutations of that array keeping the same length. I was using the array \[1,2,3,4,5\] after trying for a bit i just decided to do it the hard way. However i…

---

## [Text in WEBGL crashes mobile browsers](https://discourse.processing.org/t/text-in-webgl-crashes-mobile-browsers/17134)

<div class="topic-metadata">

**Author:** [@0\_O\_W\_O\_0](https://discourse.processing.org/u/0_O_W_O_0)\
**Replies:** 1\
**Last updated:** [January 21, 2020, 11:39pm UTC](https://discourse.processing.org/t/text-in-webgl-crashes-mobile-browsers/17134 "2020-01-21T23:39:55Z")

</div>

hello, first time p5js user here i am trying to make a sketch display text in a 3D environment it works just fine on a computer browser, but on mobile devices it crashes the browser. you can try it out here: https://…

---

## [Variable pollution across objects from class](https://discourse.processing.org/t/variable-pollution-across-objects-from-class/17221)

<div class="topic-metadata">

**Author:** [@marloguer](https://discourse.processing.org/u/marloguer)\
**Replies:** 0\
**Last updated:** [January 21, 2020, 11:46am UTC](https://discourse.processing.org/t/variable-pollution-across-objects-from-class/17221 "2020-01-21T11:46:59Z")

</div>

Hello, Im new to p5.js but am using it via the react-p5-wrapper for data-visualisation within a react webapp… I can successfully render ‘strings’ to screen such that a string starts off-screen-right at a random yPositio…

---

## [Set Focus to an DOM Input Field](https://discourse.processing.org/t/set-focus-to-an-dom-input-field/17140)

<div class="topic-metadata">

**Author:** [@olafval](https://discourse.processing.org/u/olafval)\
**Replies:** 2\
**Last updated:** [January 21, 2020, 10:01am UTC](https://discourse.processing.org/t/set-focus-to-an-dom-input-field/17140 "2020-01-21T10:01:23Z")

</div>

How is it possible to select an input field directly by code, so that you can start typing right away? I have tried the following commands without success: input.focus(); input.style(‘focus’, true); input.style(‘focu…

---

## [Video auto play](https://discourse.processing.org/t/video-auto-play/17195)

<div class="topic-metadata">

**Author:** [@airinterface](https://discourse.processing.org/u/airinterface)\
**Replies:** 1\
**Last updated:** [January 21, 2020, 4:24am UTC](https://discourse.processing.org/t/video-auto-play/17195 "2020-01-21T04:24:47Z")

</div>

I’m having trouble stopping autoplay. video = createCapture(VIDEO, function( stream ) { console.info("video stream initialized"); video.stop(); }); video.autoplay( false ) ; video…

---

## [Draw elements in foreground vs background](https://discourse.processing.org/t/draw-elements-in-foreground-vs-background/17197)

<div class="topic-metadata">

**Author:** [@criacuervos](https://discourse.processing.org/u/criacuervos)\
**Replies:** 5\
**Last updated:** [January 21, 2020, 12:19am UTC](https://discourse.processing.org/t/draw-elements-in-foreground-vs-background/17197 "2020-01-21T00:19:18Z")

</div>

Hi all, I’m working with p5js on a shared drawing canvas where 2 people can collaborate on a drawing. I want to draw stars on the canvas that cannot be drawn over. I’m having trouble figuring out if this can be done. I …

---

## [Optimising loadImage, fitting image ratio](https://discourse.processing.org/t/optimising-loadimage-fitting-image-ratio/17200)

<div class="topic-metadata">

**Author:** [@nikodemd](https://discourse.processing.org/u/nikodemd)\
**Replies:** 2\
**Last updated:** [January 20, 2020, 2:00pm UTC](https://discourse.processing.org/t/optimising-loadimage-fitting-image-ratio/17200 "2020-01-20T14:00:29Z")

</div>

Hi guys, new here! I am making this app where I load 2 images and 2 sliders, and each slider controls the level that the image blend with each other. Basically: image DAYLIGHT is a picture of a room only with light from…

---

## [Distorted sound when loading multiple MP3s](https://discourse.processing.org/t/distorted-sound-when-loading-multiple-mp3s/17178)

<div class="topic-metadata">

**Author:** [@twin\_tone](https://discourse.processing.org/u/twin_tone)\
**Replies:** 4\
**Last updated:** [January 19, 2020, 3:05am UTC](https://discourse.processing.org/t/distorted-sound-when-loading-multiple-mp3s/17178 "2020-01-19T03:05:31Z")

</div>

Hi all, I’m trying to make an interface that crossfades between audio files depending on mouse position. The thing is, the sound is sounding terrible - like it’s being time stretched or something. Any ideas why this mig…

---

## [Trails with background Transparency](https://discourse.processing.org/t/trails-with-background-transparency/17139)

<div class="topic-metadata">

**Author:** [@Skranker](https://discourse.processing.org/u/Skranker)\
**Replies:** 2\
**Last updated:** [January 18, 2020, 12:22pm UTC](https://discourse.processing.org/t/trails-with-background-transparency/17139 "2020-01-18T12:22:17Z")

</div>

Hey everyone, i’m using background(0, 10); to get a trail effect, but i get these weird permanent trails that dont go away. Usually the screen should be black again if the background has been drawn enough times. Not s…

---

## [Query regarding to start contribution](https://discourse.processing.org/t/query-regarding-to-start-contribution/17094)

<div class="topic-metadata">

**Author:** [@SimranAggarwal](https://discourse.processing.org/u/SimranAggarwal)\
**Replies:** 2\
**Last updated:** [January 17, 2020, 7:46am UTC](https://discourse.processing.org/t/query-regarding-to-start-contribution/17094 "2020-01-17T07:46:49Z")

</div>

Hey! I am new to open source and want to contribute to processing foundation. Please guide me where to start from. Also please guide me which repository to start from. I would like to work upon Javascript.

---

## [Only take the Top One](https://discourse.processing.org/t/only-take-the-top-one/17115)

<div class="topic-metadata">

**Author:** [@phoebus](https://discourse.processing.org/u/phoebus)\
**Replies:** 3\
**Last updated:** [January 16, 2020, 12:18pm UTC](https://discourse.processing.org/t/only-take-the-top-one/17115 "2020-01-16T12:18:51Z")

</div>

Hi there, long time no see :slight\_smile: I want to make some sort of 2d picking on a 2D sketch: I made a test “isOver” on my objects, so my objects change color when mouse is over ( dist(mouseX…) So in my main I get …

---

## [P5.play - Create Sprite on a drawing canvas](https://discourse.processing.org/t/p5-play-create-sprite-on-a-drawing-canvas/17111)

<div class="topic-metadata">

**Author:** [@criacuervos](https://discourse.processing.org/u/criacuervos)\
**Replies:** 8\
**Last updated:** [January 16, 2020, 3:45am UTC](https://discourse.processing.org/t/p5-play-create-sprite-on-a-drawing-canvas/17111 "2020-01-16T03:45:29Z")

</div>

Hi everyone, I’m trying to figure out if it is possible to use createSprite/makeSprite from the p5.play library and render that on top of a drawing canvas I already have. Right now I call drawSprites() inside the draw(…

---

## [Upload a whole project to the p5 web editor](https://discourse.processing.org/t/upload-a-whole-project-to-the-p5-web-editor/16915)

<div class="topic-metadata">

**Author:** [@ursula](https://discourse.processing.org/u/ursula)\
**Replies:** 2\
**Last updated:** [January 15, 2020, 10:10pm UTC](https://discourse.processing.org/t/upload-a-whole-project-to-the-p5-web-editor/16915 "2020-01-15T22:10:58Z")

</div>

I understand how to download a full project, but is there a way to upload an entire project? I teach with P5.js and am exploring git education for collaboration and version control. I can’t find a graceful way to use …

---

## [Assigning mouseOver to object in instance mode](https://discourse.processing.org/t/assigning-mouseover-to-object-in-instance-mode/17104)

<div class="topic-metadata">

**Author:** [@lnp](https://discourse.processing.org/u/lnp)\
**Replies:** 4\
**Last updated:** [January 15, 2020, 9:40pm UTC](https://discourse.processing.org/t/assigning-mouseover-to-object-in-instance-mode/17104 "2020-01-15T21:40:40Z")

</div>

Hello peeps! I don’t really see how I can assign a mouseOver listener to generated objects in instance mode. This doesn’t work for obvious reasons (looking for the function in the object). I tried p.glyphs\_to\_show\[n\].m…

---

## [How to use asset fonts in p5](https://discourse.processing.org/t/how-to-use-asset-fonts-in-p5/17037)

<div class="topic-metadata">

**Author:** [@gregts13](https://discourse.processing.org/u/gregts13)\
**Replies:** 8\
**Last updated:** [January 13, 2020, 2:03am UTC](https://discourse.processing.org/t/how-to-use-asset-fonts-in-p5/17037 "2020-01-13T02:03:47Z")

</div>

Honored motorcycle by gregeb13 -p5.js Web Editor Error: Unsupported OpenType signature p5.js says: It looks like there was a problem loading your font. Try checking if the file path \[assets/Bold.ttf\] is correct, hostin…

---

## [Difficulties in starting out with p5.sound.js](https://discourse.processing.org/t/difficulties-in-starting-out-with-p5-sound-js/16637)

<div class="topic-metadata">

**Author:** [@roy05](https://discourse.processing.org/u/roy05)\
**Replies:** 3\
**Last updated:** [January 8, 2020, 8:38am UTC](https://discourse.processing.org/t/difficulties-in-starting-out-with-p5-sound-js/16637 "2020-01-08T08:38:43Z")

</div>

So I’m recently starting out with p5.sound.js to make an audio visualizer. However, I find myself stuck at the very first step and I would really appreciate any help. Errors: The AudioContext was not allowed to start. …

---

## [Mitosis chain reaction, cant get it under control](https://discourse.processing.org/t/mitosis-chain-reaction-cant-get-it-under-control/16937)

<div class="topic-metadata">

**Author:** [@ZenVega](https://discourse.processing.org/u/ZenVega)\
**Replies:** 2\
**Last updated:** [January 8, 2020, 6:38am UTC](https://discourse.processing.org/t/mitosis-chain-reaction-cant-get-it-under-control/16937 "2020-01-08T06:38:07Z")

</div>

Hey all, so i created this advanced version of the mitosis simulation challange (‘https://thecodingtrain.com/CodingChallenges/006-mitosis-p5.html’) and among others included a function to remerge the cells. It kinda wor…

---

## [Way to check if draw() is currently looping?](https://discourse.processing.org/t/way-to-check-if-draw-is-currently-looping/16946)

<div class="topic-metadata">

**Author:** [@maayan](https://discourse.processing.org/u/maayan)\
**Replies:** 2\
**Last updated:** [January 8, 2020, 4:12am UTC](https://discourse.processing.org/t/way-to-check-if-draw-is-currently-looping/16946 "2020-01-08T04:12:08Z")

</div>

Is there any way to check if draw() is currently looping (ie if loop/noLoop was called)? There doesn’t seem to be a way to do this in the p5 library so is there some way to check under the hood?

---

## [Lost account, lost files?](https://discourse.processing.org/t/lost-account-lost-files/16876)

<div class="topic-metadata">

**Author:** [@tomwh2010](https://discourse.processing.org/u/tomwh2010)\
**Replies:** 6\
**Last updated:** [January 7, 2020, 1:46am UTC](https://discourse.processing.org/t/lost-account-lost-files/16876 "2020-01-07T01:46:17Z")

</div>

Early december I decided to delete the gmail account thinking that I would not lose that awfully much. Now I realize that I cannot access my files on p5js online editor since I used Google to login. My bad. Is it possibl…

---

## [Disappearing/ appearing items when I click a button](https://discourse.processing.org/t/disappearing-appearing-items-when-i-click-a-button/16866)

<div class="topic-metadata">

**Author:** [@Csperedakos11](https://discourse.processing.org/u/Csperedakos11)\
**Replies:** 3\
**Last updated:** [January 4, 2020, 8:55pm UTC](https://discourse.processing.org/t/disappearing-appearing-items-when-i-click-a-button/16866 "2020-01-04T20:55:00Z")

</div>

Hi all, I’m pretty new at p5 so I’m sure my problem is fairly easy to solve, but I’ve been trying to figure it out for some time and have not been able to successfully. My Project Basically, I am trying to create a bun…

---

## [Change cursor() in instance mode](https://discourse.processing.org/t/change-cursor-in-instance-mode/16894)

<div class="topic-metadata">

**Author:** [@lnp](https://discourse.processing.org/u/lnp)\
**Replies:** 2\
**Last updated:** [January 6, 2020, 3:40pm UTC](https://discourse.processing.org/t/change-cursor-in-instance-mode/16894 "2020-01-06T15:40:41Z")

</div>

Happy new year yo! Absolutely no problem with changing the cursor in global mode but unfortunately I can’t get it to in instance mode - or even any kind of error in the console. The sketch canvas is part of a site and I…

---

## [ReferenceError: loadModel is not defined](https://discourse.processing.org/t/referenceerror-loadmodel-is-not-defined/16877)

<div class="topic-metadata">

**Author:** [@micheal](https://discourse.processing.org/u/micheal)\
**Replies:** 11\
**Last updated:** [January 5, 2020, 5:51pm UTC](https://discourse.processing.org/t/referenceerror-loadmodel-is-not-defined/16877 "2020-01-05T17:51:37Z")

</div>

Hi there I’m a new user of p5js and loving learning what’s possible! Can I get some advice please about the loadModel function? I’m getting the error in console.log: “ReferenceError: loadModel is not defined” I can’…

---

## [Sound triggered by buttons](https://discourse.processing.org/t/sound-triggered-by-buttons/16831)

<div class="topic-metadata">

**Author:** [@marianne91](https://discourse.processing.org/u/marianne91)\
**Replies:** 7\
**Last updated:** [January 5, 2020, 1:38pm UTC](https://discourse.processing.org/t/sound-triggered-by-buttons/16831 "2020-01-05T13:38:14Z")

</div>

Hi there, Does anyone have an idea of how to trigger sounds with buttons on processing? I have found a tutorial for this for p5.js but can’t make it translate to processing… Ultimately want to use buttons to trigger vi…

---

## [General guidance on idiomatic code for beginners](https://discourse.processing.org/t/general-guidance-on-idiomatic-code-for-beginners/16776)

<div class="topic-metadata">

**Author:** [@musiciantriescoding](https://discourse.processing.org/u/musiciantriescoding)\
**Replies:** 3\
**Last updated:** [January 2, 2020, 12:40am UTC](https://discourse.processing.org/t/general-guidance-on-idiomatic-code-for-beginners/16776 "2020-01-02T00:40:53Z")

</div>

Hello everyone! I have a question regarding the code of a sketch, but it’s not a specific question, so I did not post it at the coding category. I finished a sketch recently and it looks like this: The code is here: h…

---

## [Move the 2d camera has the player move](https://discourse.processing.org/t/move-the-2d-camera-has-the-player-move/16851)

<div class="topic-metadata">

**Author:** [@Westergard](https://discourse.processing.org/u/Westergard)\
**Replies:** 1\
**Last updated:** [January 4, 2020, 8:22am UTC](https://discourse.processing.org/t/move-the-2d-camera-has-the-player-move/16851 "2020-01-04T08:22:55Z")

</div>

Hello, I am doing a “Mario game” and I want my 2d view to automatically move around to follow the player has he move. Please help me! Thanks! :grin:

---

## [P5.js - sketch trying to load images from previous sketches](https://discourse.processing.org/t/p5-js-sketch-trying-to-load-images-from-previous-sketches/16830)

<div class="topic-metadata">

**Author:** [@rebekah\_tkd](https://discourse.processing.org/u/rebekah_tkd)\
**Replies:** 2\
**Last updated:** [January 4, 2020, 2:16am UTC](https://discourse.processing.org/t/p5-js-sketch-trying-to-load-images-from-previous-sketches/16830 "2020-01-04T02:16:05Z")

</div>

I’m trying to call an array of images. My sketch keeps trying to load images which are not added within the sketch. These files were loaded in previous sketches, therefore this somehow overrides the images I am attempted…

---

## [Error Create Canvas not defined- While trying to save sample project](https://discourse.processing.org/t/error-create-canvas-not-defined-while-trying-to-save-sample-project/16799)

<div class="topic-metadata">

**Author:** [@TechTrail](https://discourse.processing.org/u/TechTrail)\
**Replies:** 1\
**Last updated:** [January 3, 2020, 10:03pm UTC](https://discourse.processing.org/t/error-create-canvas-not-defined-while-trying-to-save-sample-project/16799 "2020-01-03T22:03:12Z")

</div>

I am trying to learn Java Script and I referring to Daniel Shiffman videos. I have installed Bracket and have downloaded the example project, On writing an implementation for setup and draw method I am getting the error…

---

## [Recording a sketch](https://discourse.processing.org/t/recording-a-sketch/16789)

<div class="topic-metadata">

**Author:** [@lnp](https://discourse.processing.org/u/lnp)\
**Replies:** 4\
**Last updated:** [January 3, 2020, 4:14pm UTC](https://discourse.processing.org/t/recording-a-sketch/16789 "2020-01-03T16:14:23Z")

</div>

Hi there and happy new year! What’s the easiest way to a record real video from a P5 sketch? In Processing Python mode I was using Syphon and Soundflower. I’ve found in the past that stitching screenshots together works…

---

## [KeyPressed doesn’t work](https://discourse.processing.org/t/keypressed-doesn-t-work/16787)

<div class="topic-metadata">

**Author:** [@All\_Rise](https://discourse.processing.org/u/All_Rise)\
**Replies:** 10\
**Last updated:** [January 2, 2020, 11:58am UTC](https://discourse.processing.org/t/keypressed-doesn-t-work/16787 "2020-01-02T11:58:21Z")

</div>

I’m pretty new to coding, and I have been trying to follow some of The Coding Train’s videos. But every video that he uses the keyPressed function, or anything that involves the keyboard in gameplay, nothing happens for …

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

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