# Beginners

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

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

**Page:** 3

---

## [Error attempting to open the P5.js downloaded program](https://discourse.processing.org/t/error-attempting-to-open-the-p5-js-downloaded-program/42486)

<div class="topic-metadata">

**Author:** [@Do\_Not\_Give\_Up](https://discourse.processing.org/u/Do_Not_Give_Up)\
**Replies:** 21\
**Last updated:** [July 27, 2023, 2:54pm UTC](https://discourse.processing.org/t/error-attempting-to-open-the-p5-js-downloaded-program/42486 "2023-07-27T14:54:59Z")

</div>

---

## [Can I do IP BAN on WEB (P5)?](https://discourse.processing.org/t/can-i-do-ip-ban-on-web-p5/42481)

<div class="topic-metadata">

**Author:** [@GWAK](https://discourse.processing.org/u/GWAK)\
**Replies:** 2\
**Last updated:** [July 23, 2023, 7:56pm UTC](https://discourse.processing.org/t/can-i-do-ip-ban-on-web-p5/42481 "2023-07-23T19:56:55Z")

</div>

Can I do IP BAN on WEB (P5)? hello. Thank you for your interest in my article. We confirmed that there is an ‘IP BAN’ function in ‘WEB’ that we use. Is there any way to do ‘IP BAN’ in ‘P5’? Or do you have a ‘solution’…

---

## [White Screen and Error Handling Issues in p5.js Online Editor](https://discourse.processing.org/t/white-screen-and-error-handling-issues-in-p5-js-online-editor/42437)

<div class="topic-metadata">

**Author:** [@jayzhofen](https://discourse.processing.org/u/jayzhofen)\
**Replies:** 2\
**Last updated:** [July 19, 2023, 8:59am UTC](https://discourse.processing.org/t/white-screen-and-error-handling-issues-in-p5-js-online-editor/42437 "2023-07-19T08:59:36Z")

</div>

I’m encountering an issue with the p5.js online editor (https://editor.p5js.org). When I input the following code: c function setup() { createCanvas(400, 400); } function draw() { background(220); } I receive a se…

---

## [Zoom of a browser](https://discourse.processing.org/t/zoom-of-a-browser/42421)

<div class="topic-metadata">

**Author:** [@Chigoz](https://discourse.processing.org/u/Chigoz)\
**Replies:** 3\
**Last updated:** [July 15, 2023, 10:26am UTC](https://discourse.processing.org/t/zoom-of-a-browser/42421 "2023-07-15T10:26:12Z")

</div>

Hi Pals, how do I access the zoom DOM element of a browser?..my project has a major design flaw that requires zooming out from 100 to 50%. I want to access the zoom dom so I will set the zoom at 50%. I also want the opti…

---

## [Requesting Permission for Accessing Accelerometer Data](https://discourse.processing.org/t/requesting-permission-for-accessing-accelerometer-data/42402)

<div class="topic-metadata">

**Author:** [@Arcriet](https://discourse.processing.org/u/Arcriet)\
**Replies:** 0\
**Last updated:** [July 12, 2023, 1:46am UTC](https://discourse.processing.org/t/requesting-permission-for-accessing-accelerometer-data/42402 "2023-07-12T01:46:58Z")

</div>

Hi all, I am a beginner just starting to learn p5.js. The current version of iOS does not allow users to directly access accelerometer data in the browser. In older versions of iOS, one could enable this permission in t…

---

## [Scope and random number generators](https://discourse.processing.org/t/scope-and-random-number-generators/42385)

<div class="topic-metadata">

**Author:** [@Sambo](https://discourse.processing.org/u/Sambo)\
**Replies:** 1\
**Last updated:** [July 9, 2023, 6:41pm UTC](https://discourse.processing.org/t/scope-and-random-number-generators/42385 "2023-07-09T18:41:26Z")

</div>

I understand the problem with choosing randoms either 1: inside function draw(), or 2: inside functions that are called inside draw, but why is it that random() is a scope error outside of setup() ? Is it necessary to g…

---

## [Change default name for right-click "Save image as..."](https://discourse.processing.org/t/change-default-name-for-right-click-save-image-as/42245)

<div class="topic-metadata">

**Author:** [@guille](https://discourse.processing.org/u/guille)\
**Replies:** 2\
**Last updated:** [June 20, 2023, 10:08am UTC](https://discourse.processing.org/t/change-default-name-for-right-click-save-image-as/42245 "2023-06-20T10:08:07Z")

</div>

In Firefox, a p5 canvas can be saved with right click and “Save image as…”. The default name it gives is canvas.png. I know I could use saveCanvas(), but I’d like to use the native browser menu. Is there any way to set t…

---

## [Why I get \`undefined\` when I console.log \`image(img, x, y)\` but get a p5 object when i console.log \`text(text, x, y)\`?](https://discourse.processing.org/t/why-i-get-undefined-when-i-console-log-image-img-x-y-but-get-a-p5-object-when-i-console-log-text-text-x-y/42073)

<div class="topic-metadata">

**Author:** [@WaningJupiter](https://discourse.processing.org/u/WaningJupiter)\
**Replies:** 3\
**Last updated:** [May 26, 2023, 1:25pm UTC](https://discourse.processing.org/t/why-i-get-undefined-when-i-console-log-image-img-x-y-but-get-a-p5-object-when-i-console-log-text-text-x-y/42073 "2023-05-26T13:25:35Z")

</div>

Hello community, my question is described in the title let img; function preload(){ img = loadImage('https://placehold.co/600x400'); } function setup() { createCanvas(600, 400); background(220); let word = t…

---

## [Linking classes between files outside of p5js web editor](https://discourse.processing.org/t/linking-classes-between-files-outside-of-p5js-web-editor/42048)

<div class="topic-metadata">

**Author:** [@hifilo](https://discourse.processing.org/u/hifilo)\
**Replies:** 4\
**Last updated:** [May 22, 2023, 6:21pm UTC](https://discourse.processing.org/t/linking-classes-between-files-outside-of-p5js-web-editor/42048 "2023-05-22T18:21:57Z")

</div>

Hello, in the p5js web editor I noticed you can separate classes with files, by linking the class.js inside index.html. Is this specific to the p5js web editor or can I link classes the same way in another IDE?

---

## [How do I make this image using loops but the circle does not have to be included](https://discourse.processing.org/t/how-do-i-make-this-image-using-loops-but-the-circle-does-not-have-to-be-included/41980)

<div class="topic-metadata">

**Author:** [@Computerscience](https://discourse.processing.org/u/Computerscience)\
**Replies:** 2\
**Last updated:** [May 12, 2023, 11:53pm UTC](https://discourse.processing.org/t/how-do-i-make-this-image-using-loops-but-the-circle-does-not-have-to-be-included/41980 "2023-05-12T23:53:33Z")

</div>

function setup() { createCanvas(400, 400); } function draw() { background(220); ellipse(200,200,50,50) for (let count = 25; count \< 10; count++) { line(50,200,200,20) } } image needed to make:

---

## [How do I make it so that the rollover also exists for the right circle and not just the left circle](https://discourse.processing.org/t/how-do-i-make-it-so-that-the-rollover-also-exists-for-the-right-circle-and-not-just-the-left-circle/41954)

<div class="topic-metadata">

**Author:** [@Computerscience](https://discourse.processing.org/u/Computerscience)\
**Replies:** 1\
**Last updated:** [May 9, 2023, 5:38pm UTC](https://discourse.processing.org/t/how-do-i-make-it-so-that-the-rollover-also-exists-for-the-right-circle-and-not-just-the-left-circle/41954 "2023-05-09T17:38:07Z")

</div>

var x = 150; var y = 200; var d = 200; var e= 250; function setup() { createCanvas(400, 400); } function draw() { background(255,0,0) if (dist(mouseX, mouseY, x, y) \< d/2) { background(0,255,0); } else { …

---

## [How do I make it that my object (robot) moves in random directions across the screen each time I run the program?](https://discourse.processing.org/t/how-do-i-make-it-that-my-object-robot-moves-in-random-directions-across-the-screen-each-time-i-run-the-program/41812)

<div class="topic-metadata">

**Author:** [@Computerscience](https://discourse.processing.org/u/Computerscience)\
**Replies:** 2\
**Last updated:** [May 1, 2023, 4:10pm UTC](https://discourse.processing.org/t/how-do-i-make-it-that-my-object-robot-moves-in-random-directions-across-the-screen-each-time-i-run-the-program/41812 "2023-05-01T16:10:31Z")

</div>

Question: How do I make it that my object (robot) moves in random directions across the screen each time I run the program? Code: //head var x = 200; //body var e = 400; //arms var x1= 280; var y1 = 120; //legs var…

---

## [Why is splice() not working in the web editor?](https://discourse.processing.org/t/why-is-splice-not-working-in-the-web-editor/41870)

<div class="topic-metadata">

**Author:** [@swenzel](https://discourse.processing.org/u/swenzel)\
**Replies:** 3\
**Last updated:** [April 29, 2023, 6:06pm UTC](https://discourse.processing.org/t/why-is-splice-not-working-in-the-web-editor/41870 "2023-04-29T18:06:43Z")

</div>

I may be missing something very simple here. I am trying to use splice to add 0 onto the front of this array. However, the result of both console logs are \[0,1,2,3,4,5\]. It’s like it is retroactively adding the zero to t…

---

## [Javascript email validation](https://discourse.processing.org/t/javascript-email-validation/41861)

<div class="topic-metadata">

**Author:** [@jonathan22](https://discourse.processing.org/u/jonathan22)\
**Replies:** 0\
**Last updated:** [April 28, 2023, 11:35am UTC](https://discourse.processing.org/t/javascript-email-validation/41861 "2023-04-28T11:35:08Z")

</div>

Why does Google prefix its (private) JSON answers with while(1);? For example, here’s a response from Google Calendar when turning a calendar on and off: while (1); \[ \['u', \[ \['smsSentFlag', 'false'\], \['hideI…

---

## [Question About color() function and colorMode()](https://discourse.processing.org/t/question-about-color-function-and-colormode/41815)

<div class="topic-metadata">

**Author:** [@AnthonyMG](https://discourse.processing.org/u/AnthonyMG)\
**Replies:** 1\
**Last updated:** [April 24, 2023, 8:17pm UTC](https://discourse.processing.org/t/question-about-color-function-and-colormode/41815 "2023-04-24T20:17:07Z")

</div>

The color() function does not seem to work as I would have assumed. When executing the code below I get the following output: "rgba(255,255,255,1) levels c1: 255,255,255,255 rgba(0,0,0,1) levels c1: 0,0,0,255 " I woul…

---

## [Dom create statements / functions](https://discourse.processing.org/t/dom-create-statements-functions/41745)

<div class="topic-metadata">

**Author:** [@jarlook](https://discourse.processing.org/u/jarlook)\
**Replies:** 2\
**Last updated:** [April 17, 2023, 8:55pm UTC](https://discourse.processing.org/t/dom-create-statements-functions/41745 "2023-04-17T20:55:39Z")

</div>

Beginning to use some of the p5.js Dom “create” statements (e.g. createButton). I see from the documentation and earlier topics that there are a variety of methods (e.g., position and style), but I’d like to look at the…

---

## [If statement in the for loop: how to control behaviour of element based on its index number](https://discourse.processing.org/t/if-statement-in-the-for-loop-how-to-control-behaviour-of-element-based-on-its-index-number/41637)

<div class="topic-metadata">

**Author:** [@WaningJupiter](https://discourse.processing.org/u/WaningJupiter)\
**Replies:** 9\
**Last updated:** [April 9, 2023, 8:45pm UTC](https://discourse.processing.org/t/if-statement-in-the-for-loop-how-to-control-behaviour-of-element-based-on-its-index-number/41637 "2023-04-09T20:45:36Z")

</div>

Hi Here’s my situation : I have 3 lines of text, displayed like this : line1. Hello line2. Hello line3. Hello I want the first line to move towards the right direction, the second to the left, the third to the righ…

---

## [Trouble with homework](https://discourse.processing.org/t/trouble-with-homework/41647)

<div class="topic-metadata">

**Author:** [@Computerscience](https://discourse.processing.org/u/Computerscience)\
**Replies:** 5\
**Last updated:** [April 8, 2023, 2:38am UTC](https://discourse.processing.org/t/trouble-with-homework/41647 "2023-04-08T02:38:57Z")

</div>

Question: Modify your solution to Q1 such that the diameter of the circle grows and shrinks depending on the distance of the mouse pointer to the center of the circle. Hints: You’ll need the dist() function and the multi…

---

## [I have an idea of converting the languages appearing in the p5js.org/contributor-docs/#/es/ website into dropdown section](https://discourse.processing.org/t/i-have-an-idea-of-converting-the-languages-appearing-in-the-p5js-org-contributor-docs-es-website-into-dropdown-section/41554)

<div class="topic-metadata">

**Author:** [@lavanya09](https://discourse.processing.org/u/lavanya09)\
**Replies:** 0\
**Last updated:** [April 1, 2023, 8:54am UTC](https://discourse.processing.org/t/i-have-an-idea-of-converting-the-languages-appearing-in-the-p5js-org-contributor-docs-es-website-into-dropdown-section/41554 "2023-04-01T08:54:02Z")

</div>

I have an idea of creating a drop down for languages to choose it allows the website look decent it also minimizes the space @Claire Kearney-Volpe

---

## [Problem with cursor()](https://discourse.processing.org/t/problem-with-cursor/41558)

<div class="topic-metadata">

**Author:** [@ggultt](https://discourse.processing.org/u/ggultt)\
**Replies:** 6\
**Last updated:** [April 2, 2023, 10:53pm UTC](https://discourse.processing.org/t/problem-with-cursor/41558 "2023-04-02T22:53:46Z")

</div>

Hello! I’m struggling with the cursor function, I was wondering the reason why the cursor didn’t change. I thought p5.js allows the file extension including .png; Is there anything I did wrong? Thank you so much! le…

---

## [Using p5.js via npm](https://discourse.processing.org/t/using-p5-js-via-npm/35914)

<div class="topic-metadata">

**Author:** [@JaPatProccesingDis](https://discourse.processing.org/u/JaPatProccesingDis)\
**Replies:** 9\
**Last updated:** [April 1, 2023, 8:29am UTC](https://discourse.processing.org/t/using-p5-js-via-npm/35914 "2023-04-01T08:29:58Z")

</div>

Hey there! I downloaded p5 via npm locally in one of my projects. Now how do I import it to the index.html file? Is doing this worth it? Or should I rather abandon this idea and use the CDN instead?

---

## [Code being displayed in Browser instead of sketch](https://discourse.processing.org/t/code-being-displayed-in-browser-instead-of-sketch/41405)

<div class="topic-metadata">

**Author:** [@Alesk1969](https://discourse.processing.org/u/Alesk1969)\
**Replies:** 7\
**Last updated:** [March 24, 2023, 8:50am UTC](https://discourse.processing.org/t/code-being-displayed-in-browser-instead-of-sketch/41405 "2023-03-24T08:50:44Z")

</div>

Hi there! I have a very newbie question. I recently installed the P5.js library within Sublime and installed as well the Browser Sync add-on. I’ve created a subfolder called Sketches which contains the index.html file …

---

## [Displaying p5.js sketches on a Wordpress site](https://discourse.processing.org/t/displaying-p5-js-sketches-on-a-wordpress-site/41306)

<div class="topic-metadata">

**Author:** [@Liz](https://discourse.processing.org/u/Liz)\
**Replies:** 2\
**Last updated:** [March 21, 2023, 7:51am UTC](https://discourse.processing.org/t/displaying-p5-js-sketches-on-a-wordpress-site/41306 "2023-03-21T07:51:48Z")

</div>

Could anyone tell me in an idiot-proof way, how I can display p5.js sketches on a Wordpress site. I’ve worked out how to embed the web editor, but I’d prefer to upload the files to the site. I’d also prefer not to rely o…

---

## [Sketch crashing as soon as it starts playing](https://discourse.processing.org/t/sketch-crashing-as-soon-as-it-starts-playing/40955)

<div class="topic-metadata">

**Author:** [@bdooley](https://discourse.processing.org/u/bdooley)\
**Replies:** 5\
**Last updated:** [February 17, 2023, 9:39pm UTC](https://discourse.processing.org/t/sketch-crashing-as-soon-as-it-starts-playing/40955 "2023-02-17T21:39:25Z")

</div>

Hi, I am trying to make a sketch with falling squares and circles that collide with each other as well as the right and left wall and ground, but am having trouble with the sketch crashing as soon as pressing play, with…

---

## [Relative file path formatting (Windows 11)](https://discourse.processing.org/t/relative-file-path-formatting-windows-11/40838)

<div class="topic-metadata">

**Author:** [@LuisGranados](https://discourse.processing.org/u/LuisGranados)\
**Replies:** 3\
**Last updated:** [February 6, 2023, 6:01pm UTC](https://discourse.processing.org/t/relative-file-path-formatting-windows-11/40838 "2023-02-06T18:01:41Z")

</div>

I want my P5.js sketch to be able to load images from a (very large) subdirectory of jpg files elsewhere on my laptop rather than from a subfolder of the P5 sketch folder. This code works, where I have a subdirectory cal…

---

## [Is there documentation geared toward a programmer of a structured language?](https://discourse.processing.org/t/is-there-documentation-geared-toward-a-programmer-of-a-structured-language/40830)

<div class="topic-metadata">

**Author:** [@skeletor53818](https://discourse.processing.org/u/skeletor53818)\
**Replies:** 3\
**Last updated:** [February 5, 2023, 2:31pm UTC](https://discourse.processing.org/t/is-there-documentation-geared-toward-a-programmer-of-a-structured-language/40830 "2023-02-05T14:31:44Z")

</div>

Hello I recently discovered the https://p5js.org website and have been playing around a bit but I feel a bit adrift. Is there some documentation on how this all works. My exact questions are: 1.) What computer languag…

---

## [How to blur a shape?](https://discourse.processing.org/t/how-to-blur-a-shape/40441)

<div class="topic-metadata">

**Author:** [@usernamenotavailable](https://discourse.processing.org/u/usernamenotavailable)\
**Replies:** 1\
**Last updated:** [January 4, 2023, 11:53am UTC](https://discourse.processing.org/t/how-to-blur-a-shape/40441 "2023-01-04T11:53:28Z")

</div>

I know I can blur a .jpg file I load with reference | p5.js. But is there any way to blur a shape I create in code please? Like create a rect() then blur it, or blur a grid of overlapping circles as a group, like you c…

---

## [Setup p5.js for beginners](https://discourse.processing.org/t/setup-p5-js-for-beginners/40210)

<div class="topic-metadata">

**Author:** [@rajput999](https://discourse.processing.org/u/rajput999)\
**Replies:** 2\
**Last updated:** [December 19, 2022, 12:08pm UTC](https://discourse.processing.org/t/setup-p5-js-for-beginners/40210 "2022-12-19T12:08:57Z")

</div>

Can anyone please help to setup p5.js in my computer

---

## [Strange access to data class](https://discourse.processing.org/t/strange-access-to-data-class/40063)

<div class="topic-metadata">

**Author:** [@gaspard](https://discourse.processing.org/u/gaspard)\
**Replies:** 6\
**Last updated:** [December 8, 2022, 12:48pm UTC](https://discourse.processing.org/t/strange-access-to-data-class/40063 "2022-12-08T12:48:09Z")

</div>

Hi, I’ve noticed a strange behavior through the setup() et draw() method in a classical p5.js sketch. here is a brief example : file classTest.js : class classTest{ constructor(c1, c2, c3){ this.groupe = \[c1, c2, c…

---

## [Why is my p5js code is too slow after I upload it](https://discourse.processing.org/t/why-is-my-p5js-code-is-too-slow-after-i-upload-it/39936)

<div class="topic-metadata">

**Author:** [@vrtx](https://discourse.processing.org/u/vrtx)\
**Replies:** 5\
**Last updated:** [December 1, 2022, 1:14pm UTC](https://discourse.processing.org/t/why-is-my-p5js-code-is-too-slow-after-i-upload-it/39936 "2022-12-01T13:14:53Z")

</div>

Hello, i am just learning about these things, processing and p5… I made a sketch on Processing and transfer it to p5.js. What happend is that the resolution of my codes turned too slow, both of them. As o Processing as…

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

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