# Beginners

**URL:** https://discourse.processing.org/c/p5js/p5js-beginners/16.md?page=9

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

**Page:** 10

---

## [Can't form array using splitText method (loadStrings)](https://discourse.processing.org/t/cant-form-array-using-splittext-method-loadstrings/28092)

<div class="topic-metadata">

**Author:** [@geo3geo](https://discourse.processing.org/u/geo3geo)\
**Replies:** 12\
**Last updated:** [February 26, 2021, 7:41pm UTC](https://discourse.processing.org/t/cant-form-array-using-splittext-method-loadstrings/28092 "2021-02-26T19:41:32Z")

</div>

I’m trying to get text elements from a local text file into an array. pets.txt contains cat dog Hopefully this code explains the problem. Thanks for looking! var pets; var petArray = \[\]; function preload() { . . …

---

## [Multiple p5 sketches on one page](https://discourse.processing.org/t/multiple-p5-sketches-on-one-page/28035)

<div class="topic-metadata">

**Author:** [@add2fic](https://discourse.processing.org/u/add2fic)\
**Replies:** 2\
**Last updated:** [February 24, 2021, 9:13am UTC](https://discourse.processing.org/t/multiple-p5-sketches-on-one-page/28035 "2021-02-24T09:13:38Z")

</div>

Hi, I’m trying to add multiple p5 sketches on one page. I’m trying to use the .parent(‘x’) function to put the canvases inside of their own divs, when I use one it shows up just fine, but when I include two, the other on…

---

## [P5 makes me crazy！](https://discourse.processing.org/t/p5-makes-me-crazy/27907)

<div class="topic-metadata">

**Author:** [@AbleYudada](https://discourse.processing.org/u/AbleYudada)\
**Replies:** 7\
**Last updated:** [February 23, 2021, 8:23am UTC](https://discourse.processing.org/t/p5-makes-me-crazy/27907 "2021-02-23T08:23:43Z")

</div>

let planeImage var easycam; let eyex=200, eyey=100, eyez=200; let cx=100, cy=10, cz=100; let angle = 339; let dx = 1.0, dy=1.0, dz = 1.0; let pg =\[\]; let tv; let p1, p2, p3, p4, p55, p6, p7, p8; let d1, d2, d3, d4, d5…

---

## [Place a p5.js canvas inside a div](https://discourse.processing.org/t/place-a-p5-js-canvas-inside-a-div/27913)

<div class="topic-metadata">

**Author:** [@EunieceHarris](https://discourse.processing.org/u/EunieceHarris)\
**Replies:** 5\
**Last updated:** [February 19, 2021, 10:09pm UTC](https://discourse.processing.org/t/place-a-p5-js-canvas-inside-a-div/27913 "2021-02-19T22:09:59Z")

</div>

Hello! I have a diagram that I hope conveys my question: This is a screenshot of my website that I plan on showing multiple p5.js illustrations. I want to place the drawing in the div element but I’ve not been succes…

---

## [Loading excel data in P5](https://discourse.processing.org/t/loading-excel-data-in-p5/27930)

<div class="topic-metadata">

**Author:** [@xbix](https://discourse.processing.org/u/xbix)\
**Replies:** 1\
**Last updated:** [February 19, 2021, 1:53pm UTC](https://discourse.processing.org/t/loading-excel-data-in-p5/27930 "2021-02-19T13:53:06Z")

</div>

I haven’t found any libraries for that purpose. What are my options when I want to load excel data into p5? Thanks in advance

---

## [Bug with createRadio(): it doesn't create separate radios](https://discourse.processing.org/t/bug-with-createradio-it-doesnt-create-separate-radios/27856)

<div class="topic-metadata">

**Author:** [@benjaminmarkus](https://discourse.processing.org/u/benjaminmarkus)\
**Replies:** 2\
**Last updated:** [February 16, 2021, 11:55am UTC](https://discourse.processing.org/t/bug-with-createradio-it-doesnt-create-separate-radios/27856 "2021-02-16T11:55:46Z")

</div>

I want to include three separate set of radio buttons in my code and for that I am using createRadio() three separate times, such as: radio1 = createRadio(), radio2 = createRadio(), radio3= createRadio(). But there seem…

---

## [Problems with print() function](https://discourse.processing.org/t/problems-with-print-function/27824)

<div class="topic-metadata">

**Author:** [@sirin](https://discourse.processing.org/u/sirin)\
**Replies:** 7\
**Last updated:** [February 15, 2021, 1:50am UTC](https://discourse.processing.org/t/problems-with-print-function/27824 "2021-02-15T01:50:53Z")

</div>

I am new to p5.js and I encountered a problem with a simple code: var a=10; var b; function setup() { createCanvas(400, 400); //some expressions using variables go here } function draw() { background(220); //…

---

## [I need help with my code, I don't know why it isn't working](https://discourse.processing.org/t/i-need-help-with-my-code-i-dont-know-why-it-isnt-working/27689)

<div class="topic-metadata">

**Author:** [@thorax1st](https://discourse.processing.org/u/thorax1st)\
**Replies:** 16\
**Last updated:** [February 9, 2021, 3:48pm UTC](https://discourse.processing.org/t/i-need-help-with-my-code-i-dont-know-why-it-isnt-working/27689 "2021-02-09T15:48:10Z")

</div>

I have tried to make ellipses with random positions on the canvas which disappear when they are clicked on, I tried doing this by putting an if statement in a for loop which should check if the mouse is inside one of the…

---

## [Question about TexttoPoint()](https://discourse.processing.org/t/question-about-texttopoint/27627)

<div class="topic-metadata">

**Author:** [@kmn063836](https://discourse.processing.org/u/kmn063836)\
**Replies:** 7\
**Last updated:** [February 7, 2021, 4:47pm UTC](https://discourse.processing.org/t/question-about-texttopoint/27627 "2021-02-07T16:47:48Z")

</div>

Hi, I have a question about TexttoPoint() in p5.js. Is there a way to set/limit the number of points that draw the letter? For example, I’d like to draw both letters ‘A’ and ‘B’ only with 10 points but not sure how… (U…

---

## [Get width/height of text("Hello world!", x, y)?](https://discourse.processing.org/t/get-width-height-of-text-hello-world-x-y/27611)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 2\
**Last updated:** [February 5, 2021, 7:48pm UTC](https://discourse.processing.org/t/get-width-height-of-text-hello-world-x-y/27611 "2021-02-05T19:48:00Z")

</div>

Is there someway to ascertain the width and height of text printed via text("Hello world!", 100, 100);? Thanks!

---

## [How can I upload GIF in P5.image](https://discourse.processing.org/t/how-can-i-upload-gif-in-p5-image/27516)

<div class="topic-metadata">

**Author:** [@Shubham](https://discourse.processing.org/u/Shubham)\
**Replies:** 4\
**Last updated:** [February 1, 2021, 6:34pm UTC](https://discourse.processing.org/t/how-can-i-upload-gif-in-p5-image/27516 "2021-02-01T18:34:18Z")

</div>

I want to upload gif in image() but it is not getting rendered. I am saving a gif in asset folder from which it is taking other img, png file but it is not loading gif file.

---

## [Why doesn't an object return a random() value?](https://discourse.processing.org/t/why-doesnt-an-object-return-a-random-value/27448)

<div class="topic-metadata">

**Author:** [@vettefreak](https://discourse.processing.org/u/vettefreak)\
**Replies:** 8\
**Last updated:** [January 29, 2021, 12:35pm UTC](https://discourse.processing.org/t/why-doesnt-an-object-return-a-random-value/27448 "2021-01-29T12:35:23Z")

</div>

const randomizer = { "rgb1": random(0, 255), } draw = () =\> { let y = random(0, height); let x = random(0, width); noStroke(); fill(randomizer\["rgb1"\], randomizer\["rgb1"\], randomizer\["rgb1"\]); e…

---

## [Video not playing in repl.it but is playing on other platforms](https://discourse.processing.org/t/video-not-playing-in-repl-it-but-is-playing-on-other-platforms/27414)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 11\
**Last updated:** [January 28, 2021, 7:11pm UTC](https://discourse.processing.org/t/video-not-playing-in-repl-it-but-is-playing-on-other-platforms/27414 "2021-01-28T19:11:10Z")

</div>

Hi all, Does anyone have any insight as to why my code does not work on repl.it but it does work on OpenProcessing .org and on the p5.js web editor? Here’s the code: var vid; function setup() { createCanvas(0, 0); …

---

## [How to test various sketches in nested folders](https://discourse.processing.org/t/how-to-test-various-sketches-in-nested-folders/27323)

<div class="topic-metadata">

**Author:** [@skypickle](https://discourse.processing.org/u/skypickle)\
**Replies:** 1\
**Last updated:** [January 24, 2021, 2:36am UTC](https://discourse.processing.org/t/how-to-test-various-sketches-in-nested-folders/27323 "2021-01-24T02:36:29Z")

</div>

I use browser sync and sublime text to test my sketches. In a folder named project, I have: the index.html file (that refers to sketch.js) the sketch.js file the p5 folder. I subsequently made a modification to inde…

---

## [Printing delay of 500 millisecs between indices of a for loop iteration](https://discourse.processing.org/t/printing-delay-of-500-millisecs-between-indices-of-a-for-loop-iteration/27201)

<div class="topic-metadata">

**Author:** [@decentralizedmike](https://discourse.processing.org/u/decentralizedmike)\
**Replies:** 9\
**Last updated:** [January 19, 2021, 5:15pm UTC](https://discourse.processing.org/t/printing-delay-of-500-millisecs-between-indices-of-a-for-loop-iteration/27201 "2021-01-19T17:15:18Z")

</div>

Hi p5 pals! I am having trouble trying to print out text with a delay between each iteration of the for loop. Instead of printing all at once in realtime, I would like a 1/2 sec delay between each of the indices. I ha…

---

## [Sublime \> my P5.js sketch not running in localhost](https://discourse.processing.org/t/sublime-my-p5-js-sketch-not-running-in-localhost/27071)

<div class="topic-metadata">

**Author:** [@maneschka](https://discourse.processing.org/u/maneschka)\
**Replies:** 4\
**Last updated:** [January 17, 2021, 3:02am UTC](https://discourse.processing.org/t/sublime-my-p5-js-sketch-not-running-in-localhost/27071 "2021-01-17T03:02:29Z")

</div>

Hi! I just installed p5.js on my Laptop. However, when I run the code, it freezes and it shows only “loading” I’m working on windows. Does anyone know why? Thanks

---

## [\[issue\] Hi can't find the problem in my code . I am new thanks](https://discourse.processing.org/t/issue-hi-cant-find-the-problem-in-my-code-i-am-new-thanks/27099)

<div class="topic-metadata">

**Author:** [@brono](https://discourse.processing.org/u/brono)\
**Replies:** 1\
**Last updated:** [January 15, 2021, 6:13pm UTC](https://discourse.processing.org/t/issue-hi-cant-find-the-problem-in-my-code-i-am-new-thanks/27099 "2021-01-15T18:13:44Z")

</div>

I was following The coding train video 7.4. link:: \> https://www.youtube.com/watch?v=fBqaA7zRO58&list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA&index=29&ab\_channel=TheCodingTrain and I can’t find the problem I am facing. it…

---

## [Is there a way to use a native js function in p5?](https://discourse.processing.org/t/is-there-a-way-to-use-a-native-js-function-in-p5/26945)

<div class="topic-metadata">

**Author:** [@jgsantos](https://discourse.processing.org/u/jgsantos)\
**Replies:** 3\
**Last updated:** [January 10, 2021, 11:59am UTC](https://discourse.processing.org/t/is-there-a-way-to-use-a-native-js-function-in-p5/26945 "2021-01-10T11:59:18Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi, i’am wondering if it is possible to use native js functions in p5. I need, for example, to use the element.scrollTop property, but i don’t k…

---

## [Appending to two dimensional array](https://discourse.processing.org/t/appending-to-two-dimensional-array/26736)

<div class="topic-metadata">

**Author:** [@dave307](https://discourse.processing.org/u/dave307)\
**Replies:** 4\
**Last updated:** [January 3, 2021, 7:45pm UTC](https://discourse.processing.org/t/appending-to-two-dimensional-array/26736 "2021-01-03T19:45:43Z")

</div>

How would you append to a two array and append to a certain rows. like a = \[1,2,3\] b = \[5,6\] then you append a to the first column and b to the second column of another array so it would be c = \[1,2,3\] \[5,6\] hope…

---

## [Can't load API data](https://discourse.processing.org/t/cant-load-api-data/26722)

<div class="topic-metadata">

**Author:** [@Chudroy](https://discourse.processing.org/u/Chudroy)\
**Replies:** 2\
**Last updated:** [January 3, 2021, 4:03pm UTC](https://discourse.processing.org/t/cant-load-api-data/26722 "2021-01-03T16:03:43Z")

</div>

function setup() { createCanvas(400, 400); var url = "http://api.openweathermap.org/data/2.5/weather?q=London&appid=\_\_\_\_\_\_&units=metric" loadJSON(url); } Hi! When I try to load JSON data from this weather API, …

---

## [What am I missing?](https://discourse.processing.org/t/what-am-i-missing/26652)

<div class="topic-metadata">

**Author:** [@olaf000olaf](https://discourse.processing.org/u/olaf000olaf)\
**Replies:** 5\
**Last updated:** [December 31, 2020, 6:21pm UTC](https://discourse.processing.org/t/what-am-i-missing/26652 "2020-12-31T18:21:05Z")

</div>

Idk what’s happening but all of a sudden a simple for loop won’t draw a circle for me. https://www.openprocessing.org/sketch/1051206 I believe I’m missing something obvious, but I cant find it. this is stupid but can som…

---

## [Trying to run p5 code on codepen, what files to include, pls?](https://discourse.processing.org/t/trying-to-run-p5-code-on-codepen-what-files-to-include-pls/26615)

<div class="topic-metadata">

**Author:** [@richengle](https://discourse.processing.org/u/richengle)\
**Replies:** 1\
**Last updated:** [December 30, 2020, 9:21am UTC](https://discourse.processing.org/t/trying-to-run-p5-code-on-codepen-what-files-to-include-pls/26615 "2020-12-30T09:21:34Z")

</div>

i ami trying to run some p5 code from https://editor.p5js.org/aatish/sketches/SJoT7GDtf on codepen \[html/CSS/JS intepreter\] I have included https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.min.js and many other…

---

## [Porting a project from Processing to p5.js, getting stuck on an error](https://discourse.processing.org/t/porting-a-project-from-processing-to-p5-js-getting-stuck-on-an-error/26454)

<div class="topic-metadata">

**Author:** [@jjjolton](https://discourse.processing.org/u/jjjolton)\
**Replies:** 5\
**Last updated:** [December 23, 2020, 2:07am UTC](https://discourse.processing.org/t/porting-a-project-from-processing-to-p5-js-getting-stuck-on-an-error/26454 "2020-12-23T02:07:19Z")

</div>

I’ve been working on getting a Processing project ported to p5.js, mostly just to figure out how to make it work. I’ve been stuck on an error ("There’s an error due to “MakeTriangle” not being defined in the current scop…

---

## [saveStrings Reference Error](https://discourse.processing.org/t/savestrings-reference-error/26036)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 3\
**Last updated:** [December 13, 2020, 7:13am UTC](https://discourse.processing.org/t/savestrings-reference-error/26036 "2020-12-13T07:13:26Z")

</div>

The p5.js “saveStrings” Reference says: let words = ‘apple bear cat dog’; let list = split(words, ’ '); \< \< ! ! This is wrong iI needs to be… let list = words.split(’ '); This threw me for a while before I looked ha…

---

## [saveStrings again](https://discourse.processing.org/t/savestrings-again/26037)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 3\
**Last updated:** [December 12, 2020, 11:26pm UTC](https://discourse.processing.org/t/savestrings-again/26037 "2020-12-12T23:26:31Z")

</div>

I can not get the example to work. I have tried it with & without an existing target file in the home folder. Does this have to be done on a server?

---

## [How do I load and image in p5js for html?](https://discourse.processing.org/t/how-do-i-load-and-image-in-p5js-for-html/26120)

<div class="topic-metadata">

**Author:** [@olaf000olaf](https://discourse.processing.org/u/olaf000olaf)\
**Replies:** 10\
**Last updated:** [December 10, 2020, 10:07pm UTC](https://discourse.processing.org/t/how-do-i-load-and-image-in-p5js-for-html/26120 "2020-12-10T22:07:12Z")

</div>

It’s hard to explain but basically, I have a project which includes an image and I want to make an Html website that runs the p5js code. I already got the website set up and the code, but when I run it the image doesn’t …

---

## [Fixed position with createGraphics](https://discourse.processing.org/t/fixed-position-with-creategraphics/25887)

<div class="topic-metadata">

**Author:** [@juju](https://discourse.processing.org/u/juju)\
**Replies:** 12\
**Last updated:** [December 4, 2020, 10:22am UTC](https://discourse.processing.org/t/fixed-position-with-creategraphics/25887 "2020-12-04T10:22:15Z")

</div>

wanna create an always on top fixed position ellipse with createGraphics without being scrolled out of screen, tried position(0,0,'fixed'); but doesn’t work, code below, ideas? thanks. let dot; function setup() { cre…

---

## [Error on loadXML(URL) within P5js](https://discourse.processing.org/t/error-on-loadxml-url-within-p5js/25709)

<div class="topic-metadata">

**Author:** [@CAVUCO](https://discourse.processing.org/u/CAVUCO)\
**Replies:** 7\
**Last updated:** [November 26, 2020, 10:37pm UTC](https://discourse.processing.org/t/error-on-loadxml-url-within-p5js/25709 "2020-11-26T22:37:29Z")

</div>

var url ='https://www.aviationweather.gov/adds/dataserver\_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&minLat=25&minLon=-125&maxLat=50&maxLon=-66&hoursBeforeNow=1&stationstring=K\*&fields=station\_id…

---

## [How do I tint at 2D shape?](https://discourse.processing.org/t/how-do-i-tint-at-2d-shape/25727)

<div class="topic-metadata">

**Author:** [@olaf000olaf](https://discourse.processing.org/u/olaf000olaf)\
**Replies:** 2\
**Last updated:** [November 26, 2020, 5:11pm UTC](https://discourse.processing.org/t/how-do-i-tint-at-2d-shape/25727 "2020-11-26T17:11:08Z")

</div>

I tried tinting with tint(); but that only works with images, what should I do?

---

## [Running in Browser](https://discourse.processing.org/t/running-in-browser/25621)

<div class="topic-metadata">

**Author:** [@cpw](https://discourse.processing.org/u/cpw)\
**Replies:** 3\
**Last updated:** [November 23, 2020, 11:20am UTC](https://discourse.processing.org/t/running-in-browser/25621 "2020-11-23T11:20:19Z")

</div>

Hi guys I have some code running in p5.js fine. I thought all I needed to do was export and be able to open the index.html file with a browser to run on my desktop however I am getting just a loading message. Any ideas…

[Previous page](https://discourse.processing.org/c/p5js/p5js-beginners/16.md?page=8)

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