# Coding Questions

**URL:** https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=30

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

**Page:** 31

---

## [HttpDo return string?](https://discourse.processing.org/t/httpdo-return-string/22121)

<div class="topic-metadata">

**Author:** [@sasaKDH](https://discourse.processing.org/u/sasaKDH)\
**Replies:** 1\
**Last updated:** [June 24, 2020, 8:33pm UTC](https://discourse.processing.org/t/httpdo-return-string/22121 "2020-06-24T20:33:35Z")

</div>

function click6(){ if(dis==1){ username = input.value(); httpDo( userURL+username, { method: 'GET', // Other Request options, like special headers for apis headers: { Authori…

---

## [Smooth rendering of the line movement](https://discourse.processing.org/t/smooth-rendering-of-the-line-movement/22077)

<div class="topic-metadata">

**Author:** [@holyjc827](https://discourse.processing.org/u/holyjc827)\
**Replies:** 2\
**Last updated:** [June 23, 2020, 6:12am UTC](https://discourse.processing.org/t/smooth-rendering-of-the-line-movement/22077 "2020-06-23T06:12:24Z")

</div>

Hello, I have been trying to make each compass line rotate smoothly, as per noise function value. However, no matter what I try, it moves like a second hand of the clock, rather than a smooth movement of rotation. Could …

---

## [Using mouse in p5 is a bit complicated](https://discourse.processing.org/t/using-mouse-in-p5-is-a-bit-complicated/21990)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 16\
**Last updated:** [June 20, 2020, 7:21pm UTC](https://discourse.processing.org/t/using-mouse-in-p5-is-a-bit-complicated/21990 "2020-06-20T19:21:49Z")

</div>

tell me of anything that I can use that is executed in only one frame when mouse is pressed within the if condition…

---

## [Can I load an image of a buffer and add it to a sprite](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 2\
**Last updated:** [June 20, 2020, 7:19pm UTC](https://discourse.processing.org/t/can-i-load-an-image-of-a-buffer-and-add-it-to-a-sprite/22018 "2020-06-20T19:19:56Z")

</div>

I don’t know how to do it, the simple way is not working, is there any way to so it?? I am getting error like pathOfIndex is not defined on my loadImage line. Plz help me fast…

---

## [Fading between shadertoy shaders in p5.js?](https://discourse.processing.org/t/fading-between-shadertoy-shaders-in-p5-js/21933)

<div class="topic-metadata">

**Author:** [@Spenc](https://discourse.processing.org/u/Spenc)\
**Replies:** 2\
**Last updated:** [June 18, 2020, 5:16pm UTC](https://discourse.processing.org/t/fading-between-shadertoy-shaders-in-p5-js/21933 "2020-06-18T17:16:50Z")

</div>

I am trying to fade between several different types of shaders from shadertoy by importing them to p5.js and am trying to figure out the best way to do that? I am trying to figure out if I can somehow just use the tint() …

---

## [Importing a list of image URLs with createinput() and/or csv file? 📦](https://discourse.processing.org/t/importing-a-list-of-image-urls-with-createinput-and-or-csv-file/21975)

<div class="topic-metadata">

**Author:** [@jwyg](https://discourse.processing.org/u/jwyg)\
**Replies:** 1\
**Last updated:** [June 18, 2020, 10:40am UTC](https://discourse.processing.org/t/importing-a-list-of-image-urls-with-createinput-and-or-csv-file/21975 "2020-06-18T10:40:17Z")

</div>

Hello everyone! :panda\_face: This is my first post on the p5.js forum. I’m excited to join this community and look forward to learning more about what you’re all doing and seeing how I am able to contribute. :turtle: I…

---

## [Including API key in the header :(](https://discourse.processing.org/t/including-api-key-in-the-header/21936)

<div class="topic-metadata">

**Author:** [@sasaKDH](https://discourse.processing.org/u/sasaKDH)\
**Replies:** 9\
**Last updated:** [June 18, 2020, 10:21am UTC](https://discourse.processing.org/t/including-api-key-in-the-header/21936 "2020-06-18T10:21:45Z")

</div>

I want to use API but I’m not familiar with JSON and API :frowning: The site said me that I shoud include my apikey in the header but I don’t know how. function preload(){ let url1 = "https://static.api.nexon.co.kr/f…

---

## [P5.js - not displaying static gif image](https://discourse.processing.org/t/p5-js-not-displaying-static-gif-image/20948)

<div class="topic-metadata">

**Author:** [@Chrissy](https://discourse.processing.org/u/Chrissy)\
**Replies:** 18\
**Last updated:** [June 18, 2020, 10:02am UTC](https://discourse.processing.org/t/p5-js-not-displaying-static-gif-image/20948 "2020-06-18T10:02:50Z")

</div>

Hello everyone. Please may you help me. I am learning p5.js by going through the book by Lauren McCarthy titled “Make: Getting Started with p5.js” and I have become stuck with Example 7-4 on page 108. Basically the gi…

---

## [Pre Loading bottleneck](https://discourse.processing.org/t/pre-loading-bottleneck/21083)

<div class="topic-metadata">

**Author:** [@phoebus](https://discourse.processing.org/u/phoebus)\
**Replies:** 8\
**Last updated:** [June 17, 2020, 7:06pm UTC](https://discourse.processing.org/t/pre-loading-bottleneck/21083 "2020-06-17T19:06:13Z")

</div>

Hi there In my p5.js website, rich.gg ,I use a loading animation that I made using Daniel Shiffman’s technique seen here function richImg(imgName, filename) { window\[imgName\] = loadImage(filename, imgLoaded); func…

---

## [I've replaced table data with a csv and it doesn't work](https://discourse.processing.org/t/ive-replaced-table-data-with-a-csv-and-it-doesnt-work/21941)

<div class="topic-metadata">

**Author:** [@Quorum](https://discourse.processing.org/u/Quorum)\
**Replies:** 1\
**Last updated:** [June 17, 2020, 11:29am UTC](https://discourse.processing.org/t/ive-replaced-table-data-with-a-csv-and-it-doesnt-work/21941 "2020-06-17T11:29:03Z")

</div>

I’ve replaced the first row of the code you can see below to replace this data with a csv, but it doesn’t work: let games = \[ \['Boston Celtics', '105', 'Philadelphia 76ers', '87', ''\], \['Philadelphia 76ers', '127', …

---

## [Video problems only in p5.js editor](https://discourse.processing.org/t/video-problems-only-in-p5-js-editor/21852)

<div class="topic-metadata">

**Author:** [@rbgtoffolo](https://discourse.processing.org/u/rbgtoffolo)\
**Replies:** 2\
**Last updated:** [June 15, 2020, 6:21pm UTC](https://discourse.processing.org/t/video-problems-only-in-p5-js-editor/21852 "2020-06-15T18:21:34Z")

</div>

I’m trying to create a test project based on Daniel Shiffman’s Game of Life. In code, I’m using the webcam to create a new matrix every 20 frames. In offline everything works fine. Someone can help why this code does not…

---

## [Multiply Matrix and Point to apply transformation](https://discourse.processing.org/t/multiply-matrix-and-point-to-apply-transformation/21874)

<div class="topic-metadata">

**Author:** [@stephanschulz](https://discourse.processing.org/u/stephanschulz)\
**Replies:** 0\
**Last updated:** [June 14, 2020, 8:39pm UTC](https://discourse.processing.org/t/multiply-matrix-and-point-to-apply-transformation/21874 "2020-06-14T20:39:49Z")

</div>

openframeworks has makeRotationMatrix, makeTranslationMatrix, etc. and apply it to any stored coordinate. p5js has applyMatirx() but it applies to the elements being drawn not to variables. It seems http://glmatrix.net …

---

## [Issues Overlaying HTML Buttons on a P5 Canvas](https://discourse.processing.org/t/issues-overlaying-html-buttons-on-a-p5-canvas/21227)

<div class="topic-metadata">

**Author:** [@swan](https://discourse.processing.org/u/swan)\
**Replies:** 9\
**Last updated:** [June 14, 2020, 6:06pm UTC](https://discourse.processing.org/t/issues-overlaying-html-buttons-on-a-p5-canvas/21227 "2020-06-14T18:06:25Z")

</div>

Hi, I am creating a little evolutionary algorithm app as a side project. Anyway, I’m having troubles creating a hamburger button that will reveal a sidebar menu for changing settings and maybe returning to home. I would …

---

## [loadTable from object and not from url](https://discourse.processing.org/t/loadtable-from-object-and-not-from-url/21788)

<div class="topic-metadata">

**Author:** [@suvir](https://discourse.processing.org/u/suvir)\
**Replies:** 6\
**Last updated:** [June 13, 2020, 10:27am UTC](https://discourse.processing.org/t/loadtable-from-object-and-not-from-url/21788 "2020-06-13T10:27:27Z")

</div>

Hi, This is what i was doing before. p.preload = () =\> { data = (p as any).loadTable("http://127.0.0.1:3448/sample.csv", "csv", "header"); }; I would like to intiliaze the data above from a js response object. T…

---

## [P5.js using P2D and WebGL primitives](https://discourse.processing.org/t/p5-js-using-p2d-and-webgl-primitives/21824)

<div class="topic-metadata">

**Author:** [@ylh](https://discourse.processing.org/u/ylh)\
**Replies:** 1\
**Last updated:** [June 13, 2020, 1:14am UTC](https://discourse.processing.org/t/p5-js-using-p2d-and-webgl-primitives/21824 "2020-06-13T01:14:31Z")

</div>

I have a sketch that uses straightforward draws and text boxes. I now want to add a 3D drawing. Evidently WebGL will break my current code. I only have one 3D drawing which can be in a separate area. Can I have two diff…

---

## [Some problem in pushing blocks in p5.js sketch](https://discourse.processing.org/t/some-problem-in-pushing-blocks-in-p5-js-sketch/21780)

<div class="topic-metadata">

**Author:** [@Nisss](https://discourse.processing.org/u/Nisss)\
**Replies:** 3\
**Last updated:** [June 12, 2020, 10:32am UTC](https://discourse.processing.org/t/some-problem-in-pushing-blocks-in-p5-js-sketch/21780 "2020-06-12T10:32:12Z")

</div>

https://editor.p5js.org/Nis\_Collect/sketches/eeOTXD\_D2 :point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::point\_up::poi…

---

## [How to position image correctly with applyMatrix](https://discourse.processing.org/t/how-to-position-image-correctly-with-applymatrix/21766)

<div class="topic-metadata">

**Author:** [@r4nd0m](https://discourse.processing.org/u/r4nd0m)\
**Replies:** 4\
**Last updated:** [June 11, 2020, 7:38pm UTC](https://discourse.processing.org/t/how-to-position-image-correctly-with-applymatrix/21766 "2020-06-11T19:38:44Z")

</div>

Hi, I’ve started my first AR project and I can’t figure out how to position image correctly in a real world. For example, I want to replace my TV screen with custom image like this: My question is: if I know the co…

---

## [Adding one textured plane slows/lags the whole environment](https://discourse.processing.org/t/adding-one-textured-plane-slows-lags-the-whole-environment/21720)

<div class="topic-metadata">

**Author:** [@awunk](https://discourse.processing.org/u/awunk)\
**Replies:** 2\
**Last updated:** [June 11, 2020, 5:46pm UTC](https://discourse.processing.org/t/adding-one-textured-plane-slows-lags-the-whole-environment/21720 "2020-06-11T17:46:54Z")

</div>

Following some popular p5.js tutorials I got a 3d environment of cubes running, I want to add a text element for a little GUI. However, when texture(hovertext) is ran in the draw function, the environment drops from 30fp…

---

## [Generating landscapes. How to set real values?](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018)

<div class="topic-metadata">

**Author:** [@Tanya](https://discourse.processing.org/u/Tanya)\
**Replies:** 6\
**Last updated:** [June 11, 2020, 12:56pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018 "2020-06-11T12:56:19Z")

</div>

Hello! I’m creating a program in JavaScript which will generate a landscape. It would be great to use real z-coordinate values. The idea is to use some function and it’ll return me the altitude of a certain point. Well, …

---

## [How to change the button label text of widget created by selectFileInput()](https://discourse.processing.org/t/how-to-change-the-button-label-text-of-widget-created-by-selectfileinput/21335)

<div class="topic-metadata">

**Author:** [@grege2](https://discourse.processing.org/u/grege2)\
**Replies:** 8\
**Last updated:** [June 11, 2020, 8:06am UTC](https://discourse.processing.org/t/how-to-change-the-button-label-text-of-widget-created-by-selectfileinput/21335 "2020-06-11T08:06:52Z")

</div>

Hi all, Very simple question, apologies. When I use createFileInput() in p5.js, the label on the button is always “Choose Files”, and I just can’t find a way to change the dang thing. I suppose createFileInput() create…

---

## [Detect if code is being run in editor or embedded](https://discourse.processing.org/t/detect-if-code-is-being-run-in-editor-or-embedded/21259)

<div class="topic-metadata">

**Author:** [@STEMcoding](https://discourse.processing.org/u/STEMcoding)\
**Replies:** 2\
**Last updated:** [May 24, 2020, 6:46pm UTC](https://discourse.processing.org/t/detect-if-code-is-being-run-in-editor-or-embedded/21259 "2020-05-24T18:46:48Z")

</div>

I would like to be able to add something to my p5.js code to be able to detect whether the code is being run in the http://editor.p5js.org environment or if it is being run embedded in a website. If in the editor then I…

---

## [mouseClicked to get mouseX and mouseY](https://discourse.processing.org/t/mouseclicked-to-get-mousex-and-mousey/21704)

<div class="topic-metadata">

**Author:** [@Ciaran](https://discourse.processing.org/u/Ciaran)\
**Replies:** 9\
**Last updated:** [June 9, 2020, 3:46pm UTC](https://discourse.processing.org/t/mouseclicked-to-get-mousex-and-mousey/21704 "2020-06-09T15:46:16Z")

</div>

I want to be able to log the position of the mouse when it is clicked on the canvas, I can get it to work with mousePressed but the function mouseClicked() is not working can anyone point me in the right direction? Code…

---

## [Implementing Robert Hodgin's "Meander": trouble with curvature and 'modified bitangents'](https://discourse.processing.org/t/implementing-robert-hodgins-meander-trouble-with-curvature-and-modified-bitangents/21651)

<div class="topic-metadata">

**Author:** [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Replies:** 0\
**Last updated:** [June 7, 2020, 11:40am UTC](https://discourse.processing.org/t/implementing-robert-hodgins-meander-trouble-with-curvature-and-modified-bitangents/21651 "2020-06-07T11:40:58Z")

</div>

Hi! I’ve been trying to create a very basic version of Robert Hodgin (aka Flight 404) 's Meander program but I am having some difficulty and I’m not sure what the problem is. The sketch I am working on is here: https:/…

---

## [Regarding pixel manipulation from live camera feed](https://discourse.processing.org/t/regarding-pixel-manipulation-from-live-camera-feed/21643)

<div class="topic-metadata">

**Author:** [@maddyna](https://discourse.processing.org/u/maddyna)\
**Replies:** 0\
**Last updated:** [June 7, 2020, 8:28am UTC](https://discourse.processing.org/t/regarding-pixel-manipulation-from-live-camera-feed/21643 "2020-06-07T08:28:23Z")

</div>

\<!-- Tips: Format your code with \</ I am trying to map image pixels from live camera into a larger canvas but whenever i am doing that i am only getting a black canvas Can anybody suggest whr I am going wrong in my al…

---

## [Class error in code help needed](https://discourse.processing.org/t/class-error-in-code-help-needed/21620)

<div class="topic-metadata">

**Author:** [@maiat](https://discourse.processing.org/u/maiat)\
**Replies:** 12\
**Last updated:** [June 6, 2020, 8:14pm UTC](https://discourse.processing.org/t/class-error-in-code-help-needed/21620 "2020-06-06T20:14:16Z")

</div>

let numWalkers = 50; let walkers = \[\]; let dotCanvas; let pixelColor; // let walkerX = \[\]; // let walkerY = \[\]; // let speed = \[\]; // let size = \[\]; let people = \[\]; let name = \[\]; let numero = 0; function preload() { …

---

## [How can I read this json file?](https://discourse.processing.org/t/how-can-i-read-this-json-file/21623)

<div class="topic-metadata">

**Author:** [@sasaKDH](https://discourse.processing.org/u/sasaKDH)\
**Replies:** 5\
**Last updated:** [June 6, 2020, 5:11pm UTC](https://discourse.processing.org/t/how-can-i-read-this-json-file/21623 "2020-06-06T17:11:50Z")

</div>

sppo works right but, spid doesn’t I think they have same structure so, I can’t understand. Here is the structure of spid function setup() { createCanvas(300, 300); sppo = loadJSON("../jsons/spposition.json"); …

---

## [Beginner Question: About Flow](https://discourse.processing.org/t/beginner-question-about-flow/21180)

<div class="topic-metadata">

**Author:** [@katjs](https://discourse.processing.org/u/katjs)\
**Replies:** 12\
**Last updated:** [June 5, 2020, 11:09am UTC](https://discourse.processing.org/t/beginner-question-about-flow/21180 "2020-06-05T11:09:23Z")

</div>

Hello people, I’m new here and I really want some help. I’ve a bit of a problem using P5. My JS is quite poor and I’m using P5 to get a better understanding from the ground up. So I’m just trying to mess around with va…

---

## [Getting Z coordinate in WEBGL with mouse](https://discourse.processing.org/t/getting-z-coordinate-in-webgl-with-mouse/21476)

<div class="topic-metadata">

**Author:** [@Nis](https://discourse.processing.org/u/Nis)\
**Replies:** 2\
**Last updated:** [June 3, 2020, 9:40pm UTC](https://discourse.processing.org/t/getting-z-coordinate-in-webgl-with-mouse/21476 "2020-06-03T21:40:17Z")

</div>

Like we have mouseX and mouseY for x and y coordinate by mouse click. How can I get for the Z coordinate. I need to add a box in the 3d blank space, wherever I click on that 3d blank.

---

## [Rotation of cell phone in landscape](https://discourse.processing.org/t/rotation-of-cell-phone-in-landscape/21494)

<div class="topic-metadata">

**Author:** [@JoeMcKay](https://discourse.processing.org/u/JoeMcKay)\
**Replies:** 5\
**Last updated:** [June 3, 2020, 6:09pm UTC](https://discourse.processing.org/t/rotation-of-cell-phone-in-landscape/21494 "2020-06-03T18:09:32Z")

</div>

Question. I am using rotationY to get the rotation of the phone. In portrait, rotationY gives a value between 0 and 360 which is awesome, but when the phone is in landscape the Y values are between 90 to 0, 0 to 90, -…

---

## [How to make a Noisy Grain Gradient](https://discourse.processing.org/t/how-to-make-a-noisy-grain-gradient/21522)

<div class="topic-metadata">

**Author:** [@antoniofrom1984](https://discourse.processing.org/u/antoniofrom1984)\
**Replies:** 1\
**Last updated:** [June 3, 2020, 10:13am UTC](https://discourse.processing.org/t/how-to-make-a-noisy-grain-gradient/21522 "2020-06-03T10:13:05Z")

</div>

Hello all, i am aware of lerp color, but i’m wondering if it’s possible to do a noisy gradient like the image, and apply to several elements, say a wall of shapes. i wondered if Pixels function was the way to do it, but…

[Previous page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=29)

[Next page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=31)
