# p5.js

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

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

**Page:** 84

---

## [How to save logs in a Processing web app using processing.js?](https://discourse.processing.org/t/how-to-save-logs-in-a-processing-web-app-using-processing-js/15196)

<div class="topic-metadata">

**Author:** [@emabiatch](https://discourse.processing.org/u/emabiatch)\
**Replies:** 2\
**Last updated:** [November 8, 2019, 4:40am UTC](https://discourse.processing.org/t/how-to-save-logs-in-a-processing-web-app-using-processing-js/15196 "2019-11-08T04:40:53Z")

</div>

I am building a simulation of a microwave web app for my thesis. I found out that with Processing was exactly what I was looking for and with the processing.js it is possible to run it in a web page that I’ll use to shar…

---

## [saveCanvas file name issues](https://discourse.processing.org/t/savecanvas-file-name-issues/15320)

<div class="topic-metadata">

**Author:** [@andylion](https://discourse.processing.org/u/andylion)\
**Replies:** 3\
**Last updated:** [November 8, 2019, 1:48am UTC](https://discourse.processing.org/t/savecanvas-file-name-issues/15320 "2019-11-08T01:48:00Z")

</div>

So I’ve been searching through various forums trying to find a solution, and I’ve turned up empty. I’m wondering if someone here can help. I’ve created a simple sketch that generates a series of random shapes as part of…

---

## [Variable to read an array of numbers in p5?](https://discourse.processing.org/t/variable-to-read-an-array-of-numbers-in-p5/13377)

<div class="topic-metadata">

**Author:** [@calornorte](https://discourse.processing.org/u/calornorte)\
**Replies:** 4\
**Last updated:** [November 7, 2019, 10:58pm UTC](https://discourse.processing.org/t/variable-to-read-an-array-of-numbers-in-p5/13377 "2019-11-07T22:58:18Z")

</div>

I come from modular programing, (Max/puredata) world, the pic above explains better (at least for me) what I want to do in p5. I have a variable that goes in between 0 and 100, I want to use this variable to read from…

---

## [Switching between front and rear camera on a smartphone using P5.js #4140](https://discourse.processing.org/t/switching-between-front-and-rear-camera-on-a-smartphone-using-p5-js-4140/15316)

<div class="topic-metadata">

**Author:** [@GeeveGeorge](https://discourse.processing.org/u/GeeveGeorge)\
**Replies:** 0\
**Last updated:** [November 7, 2019, 4:01pm UTC](https://discourse.processing.org/t/switching-between-front-and-rear-camera-on-a-smartphone-using-p5-js-4140/15316 "2019-11-07T16:01:55Z")

</div>

Hi Guys, I have written the program below for switching between front and rear camera on a phone when clicking on the switchBtn. On cliking the button, it doesn’t switch as intended. Hope you could have a look at my cod…

---

## [How to use images on windows 10](https://discourse.processing.org/t/how-to-use-images-on-windows-10/15284)

<div class="topic-metadata">

**Author:** [@jpmills13](https://discourse.processing.org/u/jpmills13)\
**Replies:** 2\
**Last updated:** [November 7, 2019, 1:43am UTC](https://discourse.processing.org/t/how-to-use-images-on-windows-10/15284 "2019-11-07T01:43:20Z")

</div>

Im trying to insert custom images into p5JS, I cant enter any images period. Even if I change the name of the base files and rename them excatly what they were before hand the images now dont work. My code and files are …

---

## [Why wont the ball animate?](https://discourse.processing.org/t/why-wont-the-ball-animate/15273)

<div class="topic-metadata">

**Author:** [@drawrs](https://discourse.processing.org/u/drawrs)\
**Replies:** 8\
**Last updated:** [November 6, 2019, 9:11am UTC](https://discourse.processing.org/t/why-wont-the-ball-animate/15273 "2019-11-06T09:11:57Z")

</div>

// Where is the circle let x, y; function setup() { createCanvas(720, 400); // Starts in the middle } function draw() { background(200); ball(); } function ball(x, y) { x = width / 2; y = height; // D…

---

## [Storing data like a cookie?](https://discourse.processing.org/t/storing-data-like-a-cookie/15258)

<div class="topic-metadata">

**Author:** [@KeirMeDear](https://discourse.processing.org/u/KeirMeDear)\
**Replies:** 2\
**Last updated:** [November 5, 2019, 7:16pm UTC](https://discourse.processing.org/t/storing-data-like-a-cookie/15258 "2019-11-05T19:16:25Z")

</div>

How would you go about holding data in a P5 sketch online if someone came back to it later. For example, if I had a piece of code where you can choose the fill color of a rect, how could you make it store that value so …

---

## [Splice function](https://discourse.processing.org/t/splice-function/15185)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 6\
**Last updated:** [November 5, 2019, 5:51pm UTC](https://discourse.processing.org/t/splice-function/15185 "2019-11-05T17:51:09Z")

</div>

Hi all, I’m trying to use the splice function for an array as described here and here but it’s not working in my code. I’ve implemented it on line 161. Does anyone have any insights? Thanks! Here’s a link to the code …

---

## [P5.js : Trouble with clicking buttons and make object move around on canvas](https://discourse.processing.org/t/p5-js-trouble-with-clicking-buttons-and-make-object-move-around-on-canvas/15242)

<div class="topic-metadata">

**Author:** [@Jenny1227](https://discourse.processing.org/u/Jenny1227)\
**Replies:** 2\
**Last updated:** [November 5, 2019, 6:00am UTC](https://discourse.processing.org/t/p5-js-trouble-with-clicking-buttons-and-make-object-move-around-on-canvas/15242 "2019-11-05T06:00:23Z")

</div>

I am really new to p5.js, and I’m trying to find a solution to this. I have a button. I wish to make my rabbit appear on canvas and jump up and down when the button is clicked. Now the rabbit only appear on canvas with …

---

## [P5.js WEBGL how to deal with big image files?](https://discourse.processing.org/t/p5-js-webgl-how-to-deal-with-big-image-files/14972)

<div class="topic-metadata">

**Author:** [@hilkeros](https://discourse.processing.org/u/hilkeros)\
**Replies:** 1\
**Last updated:** [November 3, 2019, 1:36pm UTC](https://discourse.processing.org/t/p5-js-webgl-how-to-deal-with-big-image-files/14972 "2019-11-03T13:36:15Z")

</div>

disclaimer: the links to my work in progress contain nudity. I consider the images as art, but I want to inform you about that before you click. I am working on an audiovisual project. First, I was doing everything with…

---

## [How to rotate or setState of easycam during mouse wheel zooming?](https://discourse.processing.org/t/how-to-rotate-or-setstate-of-easycam-during-mouse-wheel-zooming/14925)

<div class="topic-metadata">

**Author:** [@hmdeif](https://discourse.processing.org/u/hmdeif)\
**Replies:** 6\
**Last updated:** [November 3, 2019, 2:54am UTC](https://discourse.processing.org/t/how-to-rotate-or-setstate-of-easycam-during-mouse-wheel-zooming/14925 "2019-11-03T02:54:15Z")

</div>

Currently I’m trying to rotate a cube if the camera approaches it at a certain distance (300). But all rotation or setState functions are not working properly as it seems they are not interrupting the current zoom proces…

---

## [Get() and images](https://discourse.processing.org/t/get-and-images/15092)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 2\
**Last updated:** [October 31, 2019, 11:13pm UTC](https://discourse.processing.org/t/get-and-images/15092 "2019-10-31T23:13:29Z")

</div>

Hi all, With the following sketch, the image is drawn at (140, 500). However, when I sample the image using the get() function, it acts as though the image is drawn at (0, 0). How do I correct this? Thanks! let colour…

---

## [P5js audio array loop issues](https://discourse.processing.org/t/p5js-audio-array-loop-issues/15044)

<div class="topic-metadata">

**Author:** [@Indieminor](https://discourse.processing.org/u/Indieminor)\
**Replies:** 5\
**Last updated:** [October 30, 2019, 11:04pm UTC](https://discourse.processing.org/t/p5js-audio-array-loop-issues/15044 "2019-10-30T23:04:53Z")

</div>

Hi all, I am building an audio/visual project where I have a visual and background change on click and I want a sound to play every time the mouse is clicked. So click once, animation/track1, click again, animation/track…

---

## [Storing drawing data in array for P5 drawing application?](https://discourse.processing.org/t/storing-drawing-data-in-array-for-p5-drawing-application/14951)

<div class="topic-metadata">

**Author:** [@jaymesdec](https://discourse.processing.org/u/jaymesdec)\
**Replies:** 3\
**Last updated:** [October 28, 2019, 3:01pm UTC](https://discourse.processing.org/t/storing-drawing-data-in-array-for-p5-drawing-application/14951 "2019-10-28T15:01:24Z")

</div>

Hi I am trying to help out a few of my students with a question that they have about drawing programs that they are building in P5. Start by drawing to the canvas using: line(mouseX, mouseY, pmouseX, pmouseY Then if t…

---

## [Teaching p5js - what to do about svg?](https://discourse.processing.org/t/teaching-p5js-what-to-do-about-svg/14830)

<div class="topic-metadata">

**Author:** [@grhabyt](https://discourse.processing.org/u/grhabyt)\
**Replies:** 3\
**Last updated:** [October 27, 2019, 9:28pm UTC](https://discourse.processing.org/t/teaching-p5js-what-to-do-about-svg/14830 "2019-10-27T21:28:24Z")

</div>

I teach p5js to undergraduates as part of a Screen-Based Interaction Design course. It’s great until we get to intermediate data visualization. Importing json and drawing circles is fine, but what everyone wants to do, e…

---

## [Updating global variables inside draw() function](https://discourse.processing.org/t/updating-global-variables-inside-draw-function/14945)

<div class="topic-metadata">

**Author:** [@Ale2200](https://discourse.processing.org/u/Ale2200)\
**Replies:** 5\
**Last updated:** [October 27, 2019, 4:17pm UTC](https://discourse.processing.org/t/updating-global-variables-inside-draw-function/14945 "2019-10-27T16:17:14Z")

</div>

I cannot update global variables in the Draw() function and I think that is because it would be problematic to deal with a variable that gets updated x times per second (I suppose?), sorry but I’m totally new to p5js. Ho…

---

## [Accessing data from color picker array](https://discourse.processing.org/t/accessing-data-from-color-picker-array/14960)

<div class="topic-metadata">

**Author:** [@MackMurphy](https://discourse.processing.org/u/MackMurphy)\
**Replies:** 2\
**Last updated:** [October 27, 2019, 2:08pm UTC](https://discourse.processing.org/t/accessing-data-from-color-picker-array/14960 "2019-10-27T14:08:14Z")

</div>

Hi, I’m using createColorPicker in p5.js and was wondering if there was any way to individually access the r, g, and b values from it, rather than using the entire color with colorPickerName.color(), and if there is, wha…

---

## [Added sound to a program and now it crashes chrome](https://discourse.processing.org/t/added-sound-to-a-program-and-now-it-crashes-chrome/14946)

<div class="topic-metadata">

**Author:** [@Mike](https://discourse.processing.org/u/Mike)\
**Replies:** 13\
**Last updated:** [October 26, 2019, 3:38am UTC](https://discourse.processing.org/t/added-sound-to-a-program-and-now-it-crashes-chrome/14946 "2019-10-26T03:38:54Z")

</div>

Hey, I am making a project for my son who loves trains. It is all working decent at this time but as soon as i added the sound to the project and im running one of the mouse presses with the sound on it crashes chrome. …

---

## [Converting my Processing code to p5.js (ArrayList + others!)](https://discourse.processing.org/t/converting-my-processing-code-to-p5-js-arraylist-others/14936)

<div class="topic-metadata">

**Author:** [@Rod1C](https://discourse.processing.org/u/Rod1C)\
**Replies:** 2\
**Last updated:** [October 26, 2019, 2:31am UTC](https://discourse.processing.org/t/converting-my-processing-code-to-p5-js-arraylist-others/14936 "2019-10-26T02:31:18Z")

</div>

Hello there, I’m new to Processing and p5.js and am trying without success to translate this code from Processing to p5. The main thing I’m having an issue with is the ArrayList at line 21 & 26, and also the functions …

---

## [SVG to vertex code for P5JS](https://discourse.processing.org/t/svg-to-vertex-code-for-p5js/14942)

<div class="topic-metadata">

**Author:** [@dehyde](https://discourse.processing.org/u/dehyde)\
**Replies:** 1\
**Last updated:** [October 25, 2019, 12:33pm UTC](https://discourse.processing.org/t/svg-to-vertex-code-for-p5js/14942 "2019-10-25T12:33:58Z")

</div>

Hi I’m trying to implement an SVG file into P5JS Since, as I currently understand, that is not supported, I was wondering if there is a known tool to parse the SVG to P5JS shape code (ie beingShape, vertex etc…). Addi…

---

## [SOLVED? Image drop() peculiarities?](https://discourse.processing.org/t/solved-image-drop-peculiarities/14940)

<div class="topic-metadata">

**Author:** [@everythingability](https://discourse.processing.org/u/everythingability)\
**Replies:** 3\
**Last updated:** [October 25, 2019, 12:03pm UTC](https://discourse.processing.org/t/solved-image-drop-peculiarities/14940 "2019-10-25T12:03:41Z")

</div>

I think I’ve found bugs in the file.drop() area that produces really weird results… Lauren’s example ( https://github.com/processing/p5.js/issues/3055 ) doesn’t quite cut it, for reasons I mention in the sketch… This so…

---

## [Idea: Library that involves drawing and sound](https://discourse.processing.org/t/idea-library-that-involves-drawing-and-sound/13790)

<div class="topic-metadata">

**Author:** [@tanhengyeow](https://discourse.processing.org/u/tanhengyeow)\
**Replies:** 4\
**Last updated:** [October 25, 2019, 2:57am UTC](https://discourse.processing.org/t/idea-library-that-involves-drawing-and-sound/13790 "2019-10-25T02:57:49Z")

</div>

Hi all! My name is Heng Yeow and I’m an open-source enthusiast. I’m interested in K12 education and developing creative learning experiences. I’m thinking of supporting a p5 library that combines audio and drawing on c…

---

## [Why wont the train move?](https://discourse.processing.org/t/why-wont-the-train-move/14927)

<div class="topic-metadata">

**Author:** [@Mike](https://discourse.processing.org/u/Mike)\
**Replies:** 6\
**Last updated:** [October 25, 2019, 12:06am UTC](https://discourse.processing.org/t/why-wont-the-train-move/14927 "2019-10-25T00:06:02Z")

</div>

Hi everyone, Im back again with more issues haha. https://editor.p5js.org/mcfiorino624/sketches/xVaLKQ\_NF started writing a simple program I am putting together for my son. I have successfully written 2 separate prog…

---

## [Is there a similar function to modelX() in p5?](https://discourse.processing.org/t/is-there-a-similar-function-to-modelx-in-p5/13688)

<div class="topic-metadata">

**Author:** [@hmdeif](https://discourse.processing.org/u/hmdeif)\
**Replies:** 11\
**Last updated:** [October 24, 2019, 2:25pm UTC](https://discourse.processing.org/t/is-there-a-similar-function-to-modelx-in-p5/13688 "2019-10-24T14:25:26Z")

</div>

I built a program using processing, and now I’m trying to covert it to a web app using p5. As I’m transferring the code, I could not find anything in p5 like modelX() in processing? Any suggestions?

---

## [Moving from processing with java to P5.js](https://discourse.processing.org/t/moving-from-processing-with-java-to-p5-js/14912)

<div class="topic-metadata">

**Author:** [@Velouria](https://discourse.processing.org/u/Velouria)\
**Replies:** 8\
**Last updated:** [October 24, 2019, 12:58pm UTC](https://discourse.processing.org/t/moving-from-processing-with-java-to-p5-js/14912 "2019-10-24T12:58:37Z")

</div>

Hi there! Been using the java platform and recentley i’ve started to use the p5 platform. Really cool! However, I have this function for a bouncing ball that works perfectly in Java but doesnt work on js and I cant fin…

---

## [Problem with loadImage()](https://discourse.processing.org/t/problem-with-loadimage/14907)

<div class="topic-metadata">

**Author:** [@vinceibay](https://discourse.processing.org/u/vinceibay)\
**Replies:** 5\
**Last updated:** [October 24, 2019, 7:46am UTC](https://discourse.processing.org/t/problem-with-loadimage/14907 "2019-10-24T07:46:17Z")

</div>

I am currently on Dan Shiffmans 7.8 p5js tutorial https://www.youtube.com/watch?v=i2C1hrJMwz0&list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA&index=36 and I have encountered this error “p5.js says: It looks like there was a prob…

---

## [A proposed fix for the stop() method in p5.Sound Part](https://discourse.processing.org/t/a-proposed-fix-for-the-stop-method-in-p5-sound-part/14785)

<div class="topic-metadata">

**Author:** [@leobrooks](https://discourse.processing.org/u/leobrooks)\
**Replies:** 3\
**Last updated:** [October 23, 2019, 8:58pm UTC](https://discourse.processing.org/t/a-proposed-fix-for-the-stop-method-in-p5-sound-part/14785 "2019-10-23T20:58:30Z")

</div>

Hello, I am a relative newbie to coding but I have been working really hard on a project that uses the p5.Sound library in p5.js. The problem was that the stop() method was not working the way it said it should on the d…

---

## [P5.xr - help with pre-alpha testing on new XR library for p5](https://discourse.processing.org/t/p5-xr-help-with-pre-alpha-testing-on-new-xr-library-for-p5/13403)

<div class="topic-metadata">

**Author:** [@stalgiag](https://discourse.processing.org/u/stalgiag)\
**Replies:** 1\
**Last updated:** [October 22, 2019, 4:07pm UTC](https://discourse.processing.org/t/p5-xr-help-with-pre-alpha-testing-on-new-xr-library-for-p5/13403 "2019-10-22T16:07:38Z")

</div>

Hi all! I have been working alongside Vedhant Agarwal (@vedhant) on a library that allows you to make any p5 WEBGL sketch work in XR. Currently this is in pre-alpha release, we haven’t released documentation or builds y…

---

## [Game issues for christmas](https://discourse.processing.org/t/game-issues-for-christmas/14780)

<div class="topic-metadata">

**Author:** [@Mike](https://discourse.processing.org/u/Mike)\
**Replies:** 60\
**Last updated:** [October 22, 2019, 1:27am UTC](https://discourse.processing.org/t/game-issues-for-christmas/14780 "2019-10-22T01:27:20Z")

</div>

Ok first off, Hello everyone. I am new here and very new to coding. If you don’t care about the long backstory of my problem just skip to the next paragraph. I am currently working on my first large project, or at least…

---

## [Disable canvas highlighting on mobile (p5js)](https://discourse.processing.org/t/disable-canvas-highlighting-on-mobile-p5js/14859)

<div class="topic-metadata">

**Author:** [@Logix](https://discourse.processing.org/u/Logix)\
**Replies:** 0\
**Last updated:** [October 21, 2019, 3:59pm UTC](https://discourse.processing.org/t/disable-canvas-highlighting-on-mobile-p5js/14859 "2019-10-21T15:59:49Z")

</div>

On a mobile browser, when the cursor(HAND) runs it would highlight the entire canvas with light blue color. I tried disabling the DOM element highlighting but it doesn’t seem to be about the DOM. Please help thank you

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

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