# Beginners

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

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

**Page:** 12

---

## [Shows loading when i run index.html on browser](https://discourse.processing.org/t/shows-loading-when-i-run-index-html-on-browser/23485)

<div class="topic-metadata">

**Author:** [@iamgsshetty](https://discourse.processing.org/u/iamgsshetty)\
**Replies:** 2\
**Last updated:** [August 26, 2020, 11:12am UTC](https://discourse.processing.org/t/shows-loading-when-i-run-index-html-on-browser/23485 "2020-08-26T11:12:34Z")

</div>

function setup() { createCanvas(400, 400); video=createCapture(VIDEO); video.hide(); } function draw() { background(220); image(video,0,0); } output:-

---

## [The only I see is the message: "Loading..." :-(](https://discourse.processing.org/t/the-only-i-see-is-the-message-loading/23394)

<div class="topic-metadata">

**Author:** [@mancpato](https://discourse.processing.org/u/mancpato)\
**Replies:** 5\
**Last updated:** [August 21, 2020, 7:32pm UTC](https://discourse.processing.org/t/the-only-i-see-is-the-message-loading/23394 "2020-08-21T19:32:56Z")

</div>

I wrote my sketch in the online editor and runs very well. I download it and double clicked index.html, but there is only the “Loading…” message. What am I doing wrong?

---

## [Get() returns RGB values while the colorMode is set to HSB](https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827)

<div class="topic-metadata">

**Author:** [@papaboo](https://discourse.processing.org/u/papaboo)\
**Replies:** 7\
**Last updated:** [August 16, 2020, 1:34pm UTC](https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827 "2020-08-16T13:34:25Z")

</div>

I’ve swicthed to p5.js from Procesisng.js today (I’ll miss that dude) and already encountered a problem. get() returns an RGB value but my canvas is set to HSB mode. As far as I remember that wasn’t happening when I was…

---

## [Cannot load image locally](https://discourse.processing.org/t/cannot-load-image-locally/23213)

<div class="topic-metadata">

**Author:** [@carterjohnson](https://discourse.processing.org/u/carterjohnson)\
**Replies:** 2\
**Last updated:** [August 12, 2020, 6:49pm UTC](https://discourse.processing.org/t/cannot-load-image-locally/23213 "2020-08-12T18:49:22Z")

</div>

This is very basic, I understand. My code below functions in the online editor, but it does not function locally in my own computer. I’ve tried downloading the p5.js file, as well as linking to it online, but to no avai…

---

## [p5.Vector.mult issue](https://discourse.processing.org/t/p5-vector-mult-issue/23108)

<div class="topic-metadata">

**Author:** [@subhash](https://discourse.processing.org/u/subhash)\
**Replies:** 1\
**Last updated:** [August 7, 2020, 6:12pm UTC](https://discourse.processing.org/t/p5-vector-mult-issue/23108 "2020-08-07T18:12:39Z")

</div>

I am trying to multiply two vectors elementwise using p5.Vector.mult(). It shows some odd behavior. Could you tell me what am I doing wrong? My code: let v1 = createVector(-1,1,0); const rot\_axis = p5.Vector.m…

---

## [Workflow in p5js](https://discourse.processing.org/t/workflow-in-p5js/23076)

<div class="topic-metadata">

**Author:** [@Tahsin](https://discourse.processing.org/u/Tahsin)\
**Replies:** 2\
**Last updated:** [August 6, 2020, 5:34pm UTC](https://discourse.processing.org/t/workflow-in-p5js/23076 "2020-08-06T17:34:57Z")

</div>

Hey! So, I mostly code in processing java and py. But I wanna get started with javascript. I’ve tried the online p5 editor. But I couldn’t find a way to integrate it with github. I tried using localhost just like Dan s…

---

## [loadStrings only works in the editor](https://discourse.processing.org/t/loadstrings-only-works-in-the-editor/22807)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 3\
**Last updated:** [July 24, 2020, 5:43pm UTC](https://discourse.processing.org/t/loadstrings-only-works-in-the-editor/22807 "2020-07-24T17:43:55Z")

</div>

I downloaded this working sketch but it didn’t work on my desktop. Do I need a server to make loadStrings() get me a local disc file? I will downloaded the project in the future when I figure out how:) Mac 10.14.6. Th…

---

## [How do I declare an array of objects?](https://discourse.processing.org/t/how-do-i-declare-an-array-of-objects/22591)

<div class="topic-metadata">

**Author:** [@fabeck01](https://discourse.processing.org/u/fabeck01)\
**Replies:** 2\
**Last updated:** [July 14, 2020, 1:54pm UTC](https://discourse.processing.org/t/how-do-i-declare-an-array-of-objects/22591 "2020-07-14T13:54:37Z")

</div>

Hello, I’m struggling with the definition of an array with the following (nested) structure - refer to picture: For each item in phase\[\] there should be: a title (string) a subtitle (string) an array of milestone …

---

## [noFill() not working in p5js](https://discourse.processing.org/t/nofill-not-working-in-p5js/22416)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 11\
**Last updated:** [July 9, 2020, 7:29pm UTC](https://discourse.processing.org/t/nofill-not-working-in-p5js/22416 "2020-07-09T19:29:47Z")

</div>

noFill() in p5js is not working for me. Is this a bug?

---

## [Can someone explain why there are trails for the ellipse?](https://discourse.processing.org/t/can-someone-explain-why-there-are-trails-for-the-ellipse/22455)

<div class="topic-metadata">

**Author:** [@BSiemens](https://discourse.processing.org/u/BSiemens)\
**Replies:** 5\
**Last updated:** [July 7, 2020, 6:58pm UTC](https://discourse.processing.org/t/can-someone-explain-why-there-are-trails-for-the-ellipse/22455 "2020-07-07T18:58:25Z")

</div>

https://p5js.org/examples/structure-create-graphics.html

---

## [Processing Desktop Editor and p5.js: \`The class "let" does not exist\`](https://discourse.processing.org/t/processing-desktop-editor-and-p5-js-the-class-let-does-not-exist/22454)

<div class="topic-metadata">

**Author:** [@Vertigo81](https://discourse.processing.org/u/Vertigo81)\
**Replies:** 2\
**Last updated:** [July 7, 2020, 6:43pm UTC](https://discourse.processing.org/t/processing-desktop-editor-and-p5-js-the-class-let-does-not-exist/22454 "2020-07-07T18:43:35Z")

</div>

Idiot question I’m sure… I can make things work fine on openprocessing.org, but when I try to run the same code on the desktop compiler it doesn’t recognize… Like, anything. Seems likely the issue is the bane of most…

---

## [Getting Right Click and Middle Mouse](https://discourse.processing.org/t/getting-right-click-and-middle-mouse/22422)

<div class="topic-metadata">

**Author:** [@SavageGarrett](https://discourse.processing.org/u/SavageGarrett)\
**Replies:** 1\
**Last updated:** [July 6, 2020, 9:17pm UTC](https://discourse.processing.org/t/getting-right-click-and-middle-mouse/22422 "2020-07-06T21:17:09Z")

</div>

I am working in a browser i.e. including my sketch.js file in an html document. Using the mouseClicked() function I can get left clicks but mouseButton only gives me left click. I would like to be able to right click o…

---

## [Do ... while ... throws 'Unexpected token '{' when line break inside](https://discourse.processing.org/t/do-while-throws-unexpected-token-when-line-break-inside/22352)

<div class="topic-metadata">

**Author:** [@Laurent](https://discourse.processing.org/u/Laurent)\
**Replies:** 4\
**Last updated:** [July 3, 2020, 2:34pm UTC](https://discourse.processing.org/t/do-while-throws-unexpected-token-when-line-break-inside/22352 "2020-07-03T14:34:03Z")

</div>

Hi everyone, Maybe I’m very tired and have a a dummy question but I’m in trouble with a simple do … while … statement… The following one: var number; do{ number = random(1, 101); print(number); …

---

## [Referencing functions within object properties does not work](https://discourse.processing.org/t/referencing-functions-within-object-properties-does-not-work/22150)

<div class="topic-metadata">

**Author:** [@kdmb](https://discourse.processing.org/u/kdmb)\
**Replies:** 11\
**Last updated:** [July 2, 2020, 1:13pm UTC](https://discourse.processing.org/t/referencing-functions-within-object-properties-does-not-work/22150 "2020-07-02T13:13:56Z")

</div>

When I press a key, I have the following: function action1 () { // Do some action. } keys = { ArrowUp: action1; } // Function from P5.js function keyPressed () { console.log( \`Key ${key} pressed!\` ); if ( …

---

## [Canvas not showing up at all](https://discourse.processing.org/t/canvas-not-showing-up-at-all/21800)

<div class="topic-metadata">

**Author:** [@KaiShaw91](https://discourse.processing.org/u/KaiShaw91)\
**Replies:** 10\
**Last updated:** [June 20, 2020, 12:47am UTC](https://discourse.processing.org/t/canvas-not-showing-up-at-all/21800 "2020-06-20T00:47:53Z")

</div>

i cant get the download version to work when i load the index.html i dont see the canvas at all setup{ createcanvas(400,400) } draw{ background(220); rect(5,5,40,30); } everything else is vanilla what it my problem Ed…

---

## [P5.js not found in parent directory](https://discourse.processing.org/t/p5-js-not-found-in-parent-directory/21981)

<div class="topic-metadata">

**Author:** [@astrogeek](https://discourse.processing.org/u/astrogeek)\
**Replies:** 9\
**Last updated:** [June 19, 2020, 11:16pm UTC](https://discourse.processing.org/t/p5-js-not-found-in-parent-directory/21981 "2020-06-19T23:16:01Z")

</div>

I’m just starting out with the p5js library, so this is a really basic question. I have downloaded the library file and unzipped it. I started messing around with the files in the “empty example” directory using Brackets…

---

## [HOW TO USE createImage()?](https://discourse.processing.org/t/how-to-use-createimage/21885)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 15\
**Last updated:** [June 19, 2020, 8:55am UTC](https://discourse.processing.org/t/how-to-use-createimage/21885 "2020-06-19T08:55:56Z")

</div>

I have an idea where I want user to draw something and make it an image. How to use it, possibly, it has something to do with createImage(), but I’m not familiar with it. Thanks for helping me with it in advance

---

## [Problem loading json url](https://discourse.processing.org/t/problem-loading-json-url/21898)

<div class="topic-metadata">

**Author:** [@maddyna](https://discourse.processing.org/u/maddyna)\
**Replies:** 3\
**Last updated:** [June 16, 2020, 7:20pm UTC](https://discourse.processing.org/t/problem-loading-json-url/21898 "2020-06-16T19:20:09Z")

</div>

function setup() { createCanvas(400, 400); let url=‘http://api.open-notify.org/iss-now.json’; loadJSON(url,drawEarthquakes,‘jsonp’); } function draw() { background(220); } function drawEarthquakes(earthquakes){ …

---

## [In p5.js web editor, can I reuse an image from assets folder in several projects?](https://discourse.processing.org/t/in-p5-js-web-editor-can-i-reuse-an-image-from-assets-folder-in-several-projects/21899)

<div class="topic-metadata">

**Author:** [@carbonne](https://discourse.processing.org/u/carbonne)\
**Replies:** 3\
**Last updated:** [June 16, 2020, 9:35am UTC](https://discourse.processing.org/t/in-p5-js-web-editor-can-i-reuse-an-image-from-assets-folder-in-several-projects/21899 "2020-06-16T09:35:14Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I’m beginning to explore p5.js web editor, and I was wondering if there is a way to reuse an image from a previous project without uploading it …

---

## [How to set character length (maxlength) for input box/text box](https://discourse.processing.org/t/how-to-set-character-length-maxlength-for-input-box-text-box/21663)

<div class="topic-metadata">

**Author:** [@chrisdean](https://discourse.processing.org/u/chrisdean)\
**Replies:** 2\
**Last updated:** [June 7, 2020, 7:01pm UTC](https://discourse.processing.org/t/how-to-set-character-length-maxlength-for-input-box-text-box/21663 "2020-06-07T19:01:54Z")

</div>

Hi all, The subject line says it all really. I have created an input box to enter text, but I need to set the maximum amount of characters that someone can type into it, ie. for a name. input = createInput(); input.po…

---

## [Tiling / repeating shader image texture](https://discourse.processing.org/t/tiling-repeating-shader-image-texture/21591)

<div class="topic-metadata">

**Author:** [@andypurbrick](https://discourse.processing.org/u/andypurbrick)\
**Replies:** 2\
**Last updated:** [June 5, 2020, 12:58pm UTC](https://discourse.processing.org/t/tiling-repeating-shader-image-texture/21591 "2020-06-05T12:58:46Z")

</div>

Hi, I’m new to p5.js and I’ve just ported a shader from shadertoy. It works fine, however, the image that I’m using as a texture is defaulting to CLAMP when I want it to REPEAT. I’ve tried to use textureWrap(REPEAT) …

---

## [How do I move an object in 3d space?](https://discourse.processing.org/t/how-do-i-move-an-object-in-3d-space/938)

<div class="topic-metadata">

**Author:** [@xxxlaf](https://discourse.processing.org/u/xxxlaf)\
**Replies:** 1\
**Last updated:** [June 14, 2018, 3:00am UTC](https://discourse.processing.org/t/how-do-i-move-an-object-in-3d-space/938 "2018-06-14T03:00:46Z")

</div>

My code is… function setup() { createCanvas(500, 500, WEBGL); } function draw() { background(200); orbitControl(); // Objects box(75, 100, 50); sphere(50) } How would I change the x and y p…

---

## [Background hides circles inside the for loop](https://discourse.processing.org/t/background-hides-circles-inside-the-for-loop/21377)

<div class="topic-metadata">

**Author:** [@dumash](https://discourse.processing.org/u/dumash)\
**Replies:** 3\
**Last updated:** [June 2, 2020, 7:29am UTC](https://discourse.processing.org/t/background-hides-circles-inside-the-for-loop/21377 "2020-06-02T07:29:14Z")

</div>

Hi, I am trying to draw a set of circles using the for loop. It works just fine, the problem is that the background (also inside the draw() function) makes the circle disappear. When I move the background to the setup…

---

## [Another question re prototpytes](https://discourse.processing.org/t/another-question-re-prototpytes/21475)

<div class="topic-metadata">

**Author:** [@femke.blanco](https://discourse.processing.org/u/femke.blanco)\
**Replies:** 1\
**Last updated:** [June 1, 2020, 2:39pm UTC](https://discourse.processing.org/t/another-question-re-prototpytes/21475 "2020-06-01T14:39:09Z")

</div>

(Please excuse the old technique.) I am able to add a function to a constructor’s prototype after I create an object, and use the function: function Thing() { this.prop1 = 1; this.prop2 = 2; } var thing1 = new …

---

## [Random to initialize variables](https://discourse.processing.org/t/random-to-initialize-variables/21466)

<div class="topic-metadata">

**Author:** [@davidhurwich](https://discourse.processing.org/u/davidhurwich)\
**Replies:** 2\
**Last updated:** [June 1, 2020, 10:46am UTC](https://discourse.processing.org/t/random-to-initialize-variables/21466 "2020-06-01T10:46:08Z")

</div>

I have a question. I’ve noticed that when I initialize variables with a value before setup(); or draw(); that it works for a string, boolean, number. However, if I try to set that value to a random number using random()…

---

## [Video preload Property](https://discourse.processing.org/t/video-preload-property/21419)

<div class="topic-metadata">

**Author:** [@stephanschulz](https://discourse.processing.org/u/stephanschulz)\
**Replies:** 3\
**Last updated:** [May 30, 2020, 11:32am UTC](https://discourse.processing.org/t/video-preload-property/21419 "2020-05-30T11:32:38Z")

</div>

Is there a way to force a dynamically loaded video to preload? I do not want to use the preload() function mentioned in the reference page. But rather the HTML DOM element, as described here: https://www.w3schools.com…

---

## [Displaying from an array](https://discourse.processing.org/t/displaying-from-an-array/21251)

<div class="topic-metadata">

**Author:** [@katjs](https://discourse.processing.org/u/katjs)\
**Replies:** 7\
**Last updated:** [May 27, 2020, 4:52pm UTC](https://discourse.processing.org/t/displaying-from-an-array/21251 "2020-05-27T16:52:48Z")

</div>

Hello guys, so I’m trying to make this counter sort of thing where a function takes in an input and then it shows it back in reverse like a countdown. But I’m unable to get it working properly as the numbers tend to just…

---

## [Javascript: Question re prototpyes](https://discourse.processing.org/t/javascript-question-re-prototpyes/21149)

<div class="topic-metadata">

**Author:** [@femke.blanco](https://discourse.processing.org/u/femke.blanco)\
**Replies:** 3\
**Last updated:** [May 25, 2020, 11:57pm UTC](https://discourse.processing.org/t/javascript-question-re-prototpyes/21149 "2020-05-25T23:57:24Z")

</div>

Why would I want to use Object.create() when I can just assign one object’s prototype to another object’s prototype? function Thingy() {} Thingy.prototype.change = function () { return this.char1 + this.char2; } funct…

---

## [How do you stop a timer as it reaches 0 in p5.js](https://discourse.processing.org/t/how-do-you-stop-a-timer-as-it-reaches-0-in-p5-js/21240)

<div class="topic-metadata">

**Author:** [@Johann75](https://discourse.processing.org/u/Johann75)\
**Replies:** 2\
**Last updated:** [May 25, 2020, 8:49am UTC](https://discourse.processing.org/t/how-do-you-stop-a-timer-as-it-reaches-0-in-p5-js/21240 "2020-05-25T08:49:02Z")

</div>

Referring the code made by Mr.Shiffman, i found that he couldn’t explain the code for stopping the timer at 0, so could anyone help with it…-Johann

---

## [Rotate p5 Vector and get angleBetweend](https://discourse.processing.org/t/rotate-p5-vector-and-get-anglebetweend/21215)

<div class="topic-metadata">

**Author:** [@Bouls631](https://discourse.processing.org/u/Bouls631)\
**Replies:** 3\
**Last updated:** [May 24, 2020, 12:23pm UTC](https://discourse.processing.org/t/rotate-p5-vector-and-get-anglebetweend/21215 "2020-05-24T12:23:17Z")

</div>

Hy every one, Here is my probleme i try to get angle between two Vectors in p5 when both Can moove. What i’ve done is : Push(); Translate(...); Bb= createVector (mouseX,mouseY) RotateZ(x); Aa= createVector(0,100); Pop(…

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

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