# p5.js

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

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

**Page:** 111

---

## [Using the p5.ts libary for angular 5 project](https://discourse.processing.org/t/using-the-p5-ts-libary-for-angular-5-project/2137)

<div class="topic-metadata">

**Author:** [@ira](https://discourse.processing.org/u/ira)\
**Replies:** 2\
**Last updated:** [August 1, 2018, 3:27pm UTC](https://discourse.processing.org/t/using-the-p5-ts-libary-for-angular-5-project/2137 "2018-08-01T15:27:27Z")

</div>

hey im trying to get p5.ts to work on angular 5 I know theirs a typescript variant for p5js on git but Im unsure how to install/add it to the app modules to get it to work. I tried using the standard p5js typescript defi…

---

## [How to make multiple 3D shapes transform / rotate as a group](https://discourse.processing.org/t/how-to-make-multiple-3d-shapes-transform-rotate-as-a-group/2200)

<div class="topic-metadata">

**Author:** [@Quilliam](https://discourse.processing.org/u/Quilliam)\
**Replies:** 1\
**Last updated:** [July 30, 2018, 12:07pm UTC](https://discourse.processing.org/t/how-to-make-multiple-3d-shapes-transform-rotate-as-a-group/2200 "2018-07-30T12:07:09Z")

</div>

I’m trying to create the illusion of a gift box by having two groups of five planes, the first would have all sides except the top (so the box is empty on the inside) and another which is the same but upside down and mor…

---

## [Problems Loading External JSON File](https://discourse.processing.org/t/problems-loading-external-json-file/2189)

<div class="topic-metadata">

**Author:** [@lazordisk](https://discourse.processing.org/u/lazordisk)\
**Replies:** 1\
**Last updated:** [July 30, 2018, 8:56am UTC](https://discourse.processing.org/t/problems-loading-external-json-file/2189 "2018-07-30T08:56:03Z")

</div>

Hello! I’m attempting to load data from an external file, where my JSON data, which is called something like exampleJSON.json and is stored in a separate JSON folder, looks like this: { "Pride and Prejudice.txt": { …

---

## [Access many files from a directory in p5](https://discourse.processing.org/t/access-many-files-from-a-directory-in-p5/2186)

<div class="topic-metadata">

**Author:** [@AFNordal](https://discourse.processing.org/u/AFNordal)\
**Replies:** 1\
**Last updated:** [July 29, 2018, 9:20pm UTC](https://discourse.processing.org/t/access-many-files-from-a-directory-in-p5/2186 "2018-07-29T21:20:59Z")

</div>

Is there a way of accessing many files without hard-coding their names manually (or having their names be “1.txt”,“2.txt”,“3.txt”,“4.txt”…)? In processing you would use file.list(), but as far as I know this doesn’t exis…

---

## [OnHit wall detection Problem](https://discourse.processing.org/t/onhit-wall-detection-problem/2133)

<div class="topic-metadata">

**Author:** [@ville2008](https://discourse.processing.org/u/ville2008)\
**Replies:** 1\
**Last updated:** [July 29, 2018, 5:48am UTC](https://discourse.processing.org/t/onhit-wall-detection-problem/2133 "2018-07-29T05:48:02Z")

</div>

i am trying to make a game in p5.js and i need a wall and when i hit that wall it stops, i’ve tryed using constrain and the var d = dist thing but nothing works, here is my source code: var ob; var wall; var scl = 20; v…

---

## [Styling HTML elements created in JavaScript](https://discourse.processing.org/t/styling-html-elements-created-in-javascript/2164)

<div class="topic-metadata">

**Author:** [@LWoodall](https://discourse.processing.org/u/LWoodall)\
**Replies:** 1\
**Last updated:** [July 28, 2018, 2:39pm UTC](https://discourse.processing.org/t/styling-html-elements-created-in-javascript/2164 "2018-07-28T14:39:25Z")

</div>

Hi I was wondering how i’d be able to give elements like the ones I made with createP specific styling. As a starting point i’d want to do something simple like make elements made from createP(wants.wants\[i\].basic\_inf…

---

## [gameLibZero.js \[video game framework\]](https://discourse.processing.org/t/gamelibzero-js-video-game-framework/1269)

<div class="topic-metadata">

**Author:** [@erkosone](https://discourse.processing.org/u/erkosone)\
**Replies:** 8\
**Last updated:** [July 28, 2018, 2:12pm UTC](https://discourse.processing.org/t/gamelibzero-js-video-game-framework/1269 "2018-07-28T14:12:32Z")

</div>

Hello, I am developing a library to make video games in p5.js The library consists of basic functions to make a game in a very short time, is based on matter.js for collisions and has a nucleus that is responsible for p…

---

## [Error with tensor](https://discourse.processing.org/t/error-with-tensor/2103)

<div class="topic-metadata">

**Author:** [@SeanW](https://discourse.processing.org/u/SeanW)\
**Replies:** 4\
**Last updated:** [July 27, 2018, 9:25pm UTC](https://discourse.processing.org/t/error-with-tensor/2103 "2018-07-27T21:25:53Z")

</div>

I am trying to redo a mouse tracking code with tensor.js so it can learn to follow, but I am getting an error when i use model.fit I think. I’m trying to train with the x and y position of the ball as input and predict t…

---

## [Integrate library into angular app](https://discourse.processing.org/t/integrate-library-into-angular-app/1110)

<div class="topic-metadata">

**Author:** [@jajanps](https://discourse.processing.org/u/jajanps)\
**Replies:** 5\
**Last updated:** [July 27, 2018, 11:49am UTC](https://discourse.processing.org/t/integrate-library-into-angular-app/1110 "2018-07-27T11:49:06Z")

</div>

I am trying to use this library in .net core angular app. Please tell me how should I do this. I am new to angular

---

## [How can I use the input value as a variable with two arguments?](https://discourse.processing.org/t/how-can-i-use-the-input-value-as-a-variable-with-two-arguments/1623)

<div class="topic-metadata">

**Author:** [@jcponce](https://discourse.processing.org/u/jcponce)\
**Replies:** 7\
**Last updated:** [July 27, 2018, 4:29am UTC](https://discourse.processing.org/t/how-can-i-use-the-input-value-as-a-variable-with-two-arguments/1623 "2018-07-27T04:29:51Z")

</div>

Hi everyone, I was able to plot complex functions using the method of domain coloring https://openprocessing.org/sketch/569018 and now I have been trying to add two inputs for changing the real and imaginary component…

---

## [Making the Snake Wiggle](https://discourse.processing.org/t/making-the-snake-wiggle/2094)

<div class="topic-metadata">

**Author:** [@BlitzBane](https://discourse.processing.org/u/BlitzBane)\
**Replies:** 3\
**Last updated:** [July 26, 2018, 4:34am UTC](https://discourse.processing.org/t/making-the-snake-wiggle/2094 "2018-07-26T04:34:02Z")

</div>

Is there any way to wiggle the snake while going to the food(the white dot)? Here is my code as well. Please help me out. Thank you :smiley:

---

## [I'm using the p5.sound library and can't get a song to play again after I've paused it](https://discourse.processing.org/t/im-using-the-p5-sound-library-and-cant-get-a-song-to-play-again-after-ive-paused-it/2057)

<div class="topic-metadata">

**Author:** [@Corafus](https://discourse.processing.org/u/Corafus)\
**Replies:** 5\
**Last updated:** [July 25, 2018, 9:48pm UTC](https://discourse.processing.org/t/im-using-the-p5-sound-library-and-cant-get-a-song-to-play-again-after-ive-paused-it/2057 "2018-07-25T21:48:35Z")

</div>

My index.html file: The sketch.js file: var song; function setup() { createCanvas(600,400); song = loadSound(“suprematism.mp3”); } function draw() { background(0); } I have just been using the console to pla…

---

## [Append a text file](https://discourse.processing.org/t/append-a-text-file/2004)

<div class="topic-metadata">

**Author:** [@Lightiix](https://discourse.processing.org/u/Lightiix)\
**Replies:** 1\
**Last updated:** [July 25, 2018, 1:48pm UTC](https://discourse.processing.org/t/append-a-text-file/2004 "2018-07-25T13:48:51Z")

</div>

Hello everyone, I am writing a program using p5.js for broswser, and I want to save ma data in a text file. I am able to load the file with loadStrings() but every function to save the data prompts download to the clie…

---

## [P5-manager for windows?](https://discourse.processing.org/t/p5-manager-for-windows/2039)

<div class="topic-metadata">

**Author:** [@munani86](https://discourse.processing.org/u/munani86)\
**Replies:** 2\
**Last updated:** [July 24, 2018, 2:14pm UTC](https://discourse.processing.org/t/p5-manager-for-windows/2039 "2018-07-24T14:14:45Z")

</div>

I just started to learn p5.js. From the start point of installing p5-manager, I got difficulties in installing p5-manager. 1\> is there any description for windowns? 2\> is it fine to skip p5-manger??

---

## [Controlling Textures on p5 + WebGL box](https://discourse.processing.org/t/controlling-textures-on-p5-webgl-box/1105)

<div class="topic-metadata">

**Author:** [@Quilliam](https://discourse.processing.org/u/Quilliam)\
**Replies:** 2\
**Last updated:** [July 24, 2018, 11:10am UTC](https://discourse.processing.org/t/controlling-textures-on-p5-webgl-box/1105 "2018-07-24T11:10:41Z")

</div>

Hi all, I’m weighing up whether to embark on a 3D, block based diorama game in CSS3 (3d transforms) or in p5 + WebGL. There are lots of issues in making a 3D isometric map with CSS3 so I’m hoping you guys have an answer…

---

## [Lorenz Attractor from Processing to p5.js](https://discourse.processing.org/t/lorenz-attractor-from-processing-to-p5-js/2000)

<div class="topic-metadata">

**Author:** [@XavierDass](https://discourse.processing.org/u/XavierDass)\
**Replies:** 5\
**Last updated:** [July 23, 2018, 8:52am UTC](https://discourse.processing.org/t/lorenz-attractor-from-processing-to-p5-js/2000 "2018-07-23T08:52:46Z")

</div>

I was enjoying making a little Lorenz attractor in p5.js, couldn’t figure out how to make a nice gradient, so I went searching and found @shiffman’s great example in Processing, (here). But I notice that p5.js does not …

---

## ["hello!" is not a function p5.js help](https://discourse.processing.org/t/hello-is-not-a-function-p5-js-help/1957)

<div class="topic-metadata">

**Author:** [@ville2008](https://discourse.processing.org/u/ville2008)\
**Replies:** 1\
**Last updated:** [July 23, 2018, 12:59am UTC](https://discourse.processing.org/t/hello-is-not-a-function-p5-js-help/1957 "2018-07-23T00:59:19Z")

</div>

this is my source code i am trying to make an interact system and im stuck i have never done this before so if it is a blatant issue dont be to hard on me i have coded in p5.js before but never done anything like this be…

---

## [Why does createCanvas runs twice](https://discourse.processing.org/t/why-does-createcanvas-runs-twice/1982)

<div class="topic-metadata">

**Author:** [@Kris](https://discourse.processing.org/u/Kris)\
**Replies:** 3\
**Last updated:** [July 22, 2018, 6:04pm UTC](https://discourse.processing.org/t/why-does-createcanvas-runs-twice/1982 "2018-07-22T18:04:27Z")

</div>

Extending the p5 class, I noticed that the createCanvas method runs twice. It runs without calling it. Is this a normal behavior, and if so why ? ORR…, did I something wrong :slight\_smile:

---

## [Flappy birds notepad++ javascript](https://discourse.processing.org/t/flappy-birds-notepad-javascript/1975)

<div class="topic-metadata">

**Author:** [@ctrembla](https://discourse.processing.org/u/ctrembla)\
**Replies:** 2\
**Last updated:** [July 22, 2018, 3:53pm UTC](https://discourse.processing.org/t/flappy-birds-notepad-javascript/1975 "2018-07-22T15:53:11Z")

</div>

OK, i’m making flappy birds using notepad ++ javascript. I was following along with this tutorial after adding the files from his neural network videos and when he tested his program mine didn’t work. I che…

---

## [Using the canvas as the parent of an element makes it disappear](https://discourse.processing.org/t/using-the-canvas-as-the-parent-of-an-element-makes-it-disappear/1937)

<div class="topic-metadata">

**Author:** [@Albizia](https://discourse.processing.org/u/Albizia)\
**Replies:** 11\
**Last updated:** [July 22, 2018, 9:02am UTC](https://discourse.processing.org/t/using-the-canvas-as-the-parent-of-an-element-makes-it-disappear/1937 "2018-07-22T09:02:10Z")

</div>

Hello, Why does a button disappear if I set canvas as his parent ? canvas = createCanvas(800, 600); button = createButton("huhu"); button.parent(canvas);

---

## [Help With Health System in p5.js Game](https://discourse.processing.org/t/help-with-health-system-in-p5-js-game/1974)

<div class="topic-metadata">

**Author:** [@Doodle\_Noodle](https://discourse.processing.org/u/Doodle_Noodle)\
**Replies:** 1\
**Last updated:** [July 22, 2018, 6:30am UTC](https://discourse.processing.org/t/help-with-health-system-in-p5-js-game/1974 "2018-07-22T06:30:57Z")

</div>

Alright, so I’ve been slowly making my own little game using p5.js, and I’ve hit a bit of a snag. I have quite a bit set up, including boundaries for the two players, key inputs, and the ability to fire “bullets” at each…

---

## [blendMode problems](https://discourse.processing.org/t/blendmode-problems/1116)

<div class="topic-metadata">

**Author:** [@renderga](https://discourse.processing.org/u/renderga)\
**Replies:** 4\
**Last updated:** [July 21, 2018, 9:49am UTC](https://discourse.processing.org/t/blendmode-problems/1116 "2018-07-21T09:49:02Z")

</div>

Hi! First post here! My name is Azur and I’m a P5js beginner, love the library and the Kadenze course! I write this post because I’m having a problem with the blendMode function, hope somebody can help me. Here’s an sc…

---

## [createVector returning undefined](https://discourse.processing.org/t/createvector-returning-undefined/1922)

<div class="topic-metadata">

**Author:** [@Liam\_McLeod44](https://discourse.processing.org/u/Liam_McLeod44)\
**Replies:** 6\
**Last updated:** [July 20, 2018, 12:55am UTC](https://discourse.processing.org/t/createvector-returning-undefined/1922 "2018-07-20T00:55:09Z")

</div>

Hi, I was recently going through one of Daniel Shiffman’s old smart rockets tutorial. My code is very similar to his only with updated syntax. I ran into an error early on which was Uncaught TypeError: Cannot read proper…

---

## [Getting a P5.js sketch to play sound on an iOS device](https://discourse.processing.org/t/getting-a-p5-js-sketch-to-play-sound-on-an-ios-device/1907)

<div class="topic-metadata">

**Author:** [@angeltapes](https://discourse.processing.org/u/angeltapes)\
**Replies:** 1\
**Last updated:** [July 19, 2018, 3:43pm UTC](https://discourse.processing.org/t/getting-a-p5-js-sketch-to-play-sound-on-an-ios-device/1907 "2018-07-19T15:43:22Z")

</div>

Hi all I’ve made some audio experiements with p5.js and the sound library - https://angeltapes.github.io/Dwalm/ I’d like to use these on my iOS device (iPhone 6s) but I can’t get any sounds to work, either in Safari or…

---

## [Finding pixels inside a shape](https://discourse.processing.org/t/finding-pixels-inside-a-shape/1829)

<div class="topic-metadata">

**Author:** [@talisman](https://discourse.processing.org/u/talisman)\
**Replies:** 4\
**Last updated:** [July 16, 2018, 8:30pm UTC](https://discourse.processing.org/t/finding-pixels-inside-a-shape/1829 "2018-07-16T20:30:53Z")

</div>

Hi all , I have a ‘bouncing ball’ , of sorts . If you have followed Dan Shiffmans’ tutorials you must have encountered one. I want to show the underlying captured video only within the bouncing ball, like a spotlight. …

---

## [P5.js Asteroid Game Question](https://discourse.processing.org/t/p5-js-asteroid-game-question/1817)

<div class="topic-metadata">

**Author:** [@BlitzBane](https://discourse.processing.org/u/BlitzBane)\
**Replies:** 16\
**Last updated:** [July 16, 2018, 7:01pm UTC](https://discourse.processing.org/t/p5-js-asteroid-game-question/1817 "2018-07-16T19:01:41Z")

</div>

How to move the Bullet into the side of the Ship? Not the angle but on where is the bullet is coming from. I want to create guns on each side because I want to be more creative. But the problem is that everytime the ship…

---

## [Rotation based on Mouse](https://discourse.processing.org/t/rotation-based-on-mouse/1766)

<div class="topic-metadata">

**Author:** [@Sapphire](https://discourse.processing.org/u/Sapphire)\
**Replies:** 1\
**Last updated:** [July 14, 2018, 8:17pm UTC](https://discourse.processing.org/t/rotation-based-on-mouse/1766 "2018-07-14T20:17:36Z")

</div>

(What I am asking is at the bottom, these are the assets I am expecting you will need.) I am currently working on a .io game project. Here is my code for the player: function Snipe(img, x, y) { this.pos = createVect…

---

## [\[SOLVED\] TypeError: xml.getChildren is not a function](https://discourse.processing.org/t/solved-typeerror-xml-getchildren-is-not-a-function/1697)

<div class="topic-metadata">

**Author:** [@T\_mex](https://discourse.processing.org/u/T_mex)\
**Replies:** 3\
**Last updated:** [July 11, 2018, 7:35pm UTC](https://discourse.processing.org/t/solved-typeerror-xml-getchildren-is-not-a-function/1697 "2018-07-11T19:35:54Z")

</div>

I’m running into an issue when trying to parse an XML file using getChildren(). var xml = new p5.XML(); xml = loadXML("XML/UserInfo.xml"); print(xm.getChildren('User')); The error I’m getting is “TypeError: xmlFil…

---

## [Trouble linking dom libraries](https://discourse.processing.org/t/trouble-linking-dom-libraries/1652)

<div class="topic-metadata">

**Author:** [@zackpi](https://discourse.processing.org/u/zackpi)\
**Replies:** 6\
**Last updated:** [July 10, 2018, 7:48pm UTC](https://discourse.processing.org/t/trouble-linking-dom-libraries/1652 "2018-07-10T19:48:50Z")

</div>

I’m getting this error, which references a line number (ln 77) in the dom library, so my guess is that my html found the dom file, but I can’t figure out why that file can’t find p5. I currently have p5.js in a different…

---

## [Question switched to p5.js category](https://discourse.processing.org/t/question-switched-to-p5-js-category/1608)

<div class="topic-metadata">

**Author:** [@ville2008](https://discourse.processing.org/u/ville2008)\
**Replies:** 4\
**Last updated:** [July 10, 2018, 4:10pm UTC](https://discourse.processing.org/t/question-switched-to-p5-js-category/1608 "2018-07-10T16:10:34Z")

</div>

when i play my game and eat a food and then move it sometimes removes my scale heres my source code sketch source: (where my move runs) var s; var scl = 20; var food = 20; var foods = 0; var foodU = foods; function se…

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

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