# Beginners

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

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

**Page:** 9

---

## [Texture from createGraphics broken at seams](https://discourse.processing.org/t/texture-from-creategraphics-broken-at-seams/30440)

<div class="topic-metadata">

**Author:** [@wuwa](https://discourse.processing.org/u/wuwa)\
**Replies:** 2\
**Last updated:** [June 2, 2021, 5:38pm UTC](https://discourse.processing.org/t/texture-from-creategraphics-broken-at-seams/30440 "2021-06-02T17:38:56Z")

</div>

Hi, trying to put a graphic texture on a 3d object using createGraphics() and some black artefacts are always showing… is there a solution to fix this? or am i doing something wrong? see example here: https://codepen.…

---

## [How do I make an asset?](https://discourse.processing.org/t/how-do-i-make-an-asset/30266)

<div class="topic-metadata">

**Author:** [@lotull07](https://discourse.processing.org/u/lotull07)\
**Replies:** 4\
**Last updated:** [May 28, 2021, 9:28am UTC](https://discourse.processing.org/t/how-do-i-make-an-asset/30266 "2021-05-28T09:28:17Z")

</div>

how do I make an asset? I have been learning to code for a while but I never learned how to make an asset

---

## [randomGaussian() definition](https://discourse.processing.org/t/randomgaussian-definition/30303)

<div class="topic-metadata">

**Author:** [@femke.blanco](https://discourse.processing.org/u/femke.blanco)\
**Replies:** 2\
**Last updated:** [May 26, 2021, 9:15pm UTC](https://discourse.processing.org/t/randomgaussian-definition/30303 "2021-05-26T21:15:06Z")

</div>

In the randomGaussian() definition, the variable y2 is never declared. Is that an oversight? Or is it deliberate and I’m missing something. Thanks in advance. https://github.com/processing/p5.js/blob/1.3.1/src/math/r…

---

## [Help me to change the color](https://discourse.processing.org/t/help-me-to-change-the-color/30263)

<div class="topic-metadata">

**Author:** [@Nico](https://discourse.processing.org/u/Nico)\
**Replies:** 2\
**Last updated:** [May 25, 2021, 1:01am UTC](https://discourse.processing.org/t/help-me-to-change-the-color/30263 "2021-05-25T01:01:31Z")

</div>

I want the small circles to be green when they approach the big circle and change to red when they move away from it, can you help me? \</\> let puntos = 80/3 let angulo = 360/puntos function setup() { createCanvas(4…

---

## [Error when splice() is called](https://discourse.processing.org/t/error-when-splice-is-called/30079)

<div class="topic-metadata">

**Author:** [@Boutrup98](https://discourse.processing.org/u/Boutrup98)\
**Replies:** 3\
**Last updated:** [May 13, 2021, 9:21am UTC](https://discourse.processing.org/t/error-when-splice-is-called/30079 "2021-05-13T09:21:42Z")

</div>

Hello everybody! We have a problem with the splice() syntax. Our program works by generating a lot of bubbles, and the bubbles then start to consume each other and will then grow bigger. The problem occurs randomly an…

---

## [What does p5.Geometry do and how to use it?](https://discourse.processing.org/t/what-does-p5-geometry-do-and-how-to-use-it/29919)

<div class="topic-metadata">

**Author:** [@heyitsabhi](https://discourse.processing.org/u/heyitsabhi)\
**Replies:** 2\
**Last updated:** [May 7, 2021, 3:06am UTC](https://discourse.processing.org/t/what-does-p5-geometry-do-and-how-to-use-it/29919 "2021-05-07T03:06:58Z")

</div>

Could you please guys tell me what p5.Geometry is doing ? I searched the GitHub and References but doesn’t understand. Can someone please post an example on Geometry. Please explain to me what it does please…

---

## [How do I access outer class I made?](https://discourse.processing.org/t/how-do-i-access-outer-class-i-made/29848)

<div class="topic-metadata">

**Author:** [@Menchi](https://discourse.processing.org/u/Menchi)\
**Replies:** 4\
**Last updated:** [May 4, 2021, 5:27pm UTC](https://discourse.processing.org/t/how-do-i-access-outer-class-i-made/29848 "2021-05-04T17:27:40Z")

</div>

Hi, i’m newbie to p5.js, and I just want to reproduce this simple code : https://www.youtube.com/watch?v=17WoOqgXsRM I’ve set up my p5 environment on Atom editor with local server to see my results on browser. So I hav…

---

## [Auto Save in p5js editor?](https://discourse.processing.org/t/auto-save-in-p5js-editor/29706)

<div class="topic-metadata">

**Author:** [@CGMSTeacher](https://discourse.processing.org/u/CGMSTeacher)\
**Replies:** 1\
**Last updated:** [April 28, 2021, 4:23pm UTC](https://discourse.processing.org/t/auto-save-in-p5js-editor/29706 "2021-04-28T16:23:15Z")

</div>

I’m a Middle School teacher new to p5js and using it with one of my 6th grade classes. My students seem to keep loosing their work despite my constant reminders to manually save. (They are in the bad habit of assuming e…

---

## [What is the difference between createGraphics() and createDiv()](https://discourse.processing.org/t/what-is-the-difference-between-creategraphics-and-creatediv/29484)

<div class="topic-metadata">

**Author:** [@turtle](https://discourse.processing.org/u/turtle)\
**Replies:** 15\
**Last updated:** [April 22, 2021, 11:55am UTC](https://discourse.processing.org/t/what-is-the-difference-between-creategraphics-and-creatediv/29484 "2021-04-22T11:55:47Z")

</div>

the code as following let pg, div; function setup() { createCanvas(400,400); pg = createGraphics(400,400); div = createDiv(); } function draw() { pg.rect(50,50,50,50); pg.fill("red"); pg.noStroke(); imag…

---

## [Help a poor noob - arrays](https://discourse.processing.org/t/help-a-poor-noob-arrays/29505)

<div class="topic-metadata">

**Author:** [@luizF](https://discourse.processing.org/u/luizF)\
**Replies:** 3\
**Last updated:** [April 19, 2021, 9:37pm UTC](https://discourse.processing.org/t/help-a-poor-noob-arrays/29505 "2021-04-19T21:37:29Z")

</div>

Hello there. I’m realy starting learning. I’m trying change the array I’m using but don’t work put the name in variable… How do i do? var fase = stage1; var stage1 = \[ \[‘0’, ‘1’, ‘0’, ‘1’\], \[‘0’, ‘1’, ‘1’, ‘0’\], \]; …

---

## [Use of p5.clear doubts](https://discourse.processing.org/t/use-of-p5-clear-doubts/29404)

<div class="topic-metadata">

**Author:** [@edufissure](https://discourse.processing.org/u/edufissure)\
**Replies:** 4\
**Last updated:** [April 18, 2021, 5:30pm UTC](https://discourse.processing.org/t/use-of-p5-clear-doubts/29404 "2021-04-18T17:30:27Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I have been developing a pacman game using p5.js library. So i face the problem that sometimes the game was going slower,till almost get stopped…

---

## [We have to claim variables in advance?](https://discourse.processing.org/t/we-have-to-claim-variables-in-advance/29431)

<div class="topic-metadata">

**Author:** [@turtle](https://discourse.processing.org/u/turtle)\
**Replies:** 6\
**Last updated:** [April 17, 2021, 6:59pm UTC](https://discourse.processing.org/t/we-have-to-claim-variables-in-advance/29431 "2021-04-17T18:59:43Z")

</div>

Interestingly, if I claim variable like function setup() { createCanvas(100,100); let pg = createGraphics(100,100); // claim variable like this } function draw() { pg.background(100); image(pg, 0, 0); } when …

---

## [Maybe one bug in the p5](https://discourse.processing.org/t/maybe-one-bug-in-the-p5/29400)

<div class="topic-metadata">

**Author:** [@turtle](https://discourse.processing.org/u/turtle)\
**Replies:** 8\
**Last updated:** [April 16, 2021, 12:15pm UTC](https://discourse.processing.org/t/maybe-one-bug-in-the-p5/29400 "2021-04-16T12:15:40Z")

</div>

the code as following let x = 50; let y = 50; let diameter = 100; let bgColor = 200; function setup() { createCanvas(400, 400); background(bgColor); noStroke(); } function touchMoved() { print(x-diameter/2, x+…

---

## [How to manipulate one shape or other p5 objects in another place](https://discourse.processing.org/t/how-to-manipulate-one-shape-or-other-p5-objects-in-another-place/29396)

<div class="topic-metadata">

**Author:** [@turtle](https://discourse.processing.org/u/turtle)\
**Replies:** 2\
**Last updated:** [April 16, 2021, 2:10am UTC](https://discourse.processing.org/t/how-to-manipulate-one-shape-or-other-p5-objects-in-another-place/29396 "2021-04-16T02:10:23Z")

</div>

I have checked out the Reference and Examples roundly, now I find that it is difficult to manipulate p5 objects in another place(only can manipulate them in where they are be defined). For example: function draw() { …

---

## [Is it possible to erase part of an object and let the background show through?](https://discourse.processing.org/t/is-it-possible-to-erase-part-of-an-object-and-let-the-background-show-through/29331)

<div class="topic-metadata">

**Author:** [@cottonchipper](https://discourse.processing.org/u/cottonchipper)\
**Replies:** 2\
**Last updated:** [April 13, 2021, 4:51pm UTC](https://discourse.processing.org/t/is-it-possible-to-erase-part-of-an-object-and-let-the-background-show-through/29331 "2021-04-13T16:51:37Z")

</div>

Is it possible to erase part of an object such as a rectangle or ellipse and allow the background color to show through? In the example I’ve got the background set to a gradient and am attempting to erase two rectangles …

---

## [P5 instance mode syntax question (createInput() constantly gets error'd not defined)](https://discourse.processing.org/t/p5-instance-mode-syntax-question-createinput-constantly-gets-errord-not-defined/29206)

<div class="topic-metadata">

**Author:** [@NayrbEroom](https://discourse.processing.org/u/NayrbEroom)\
**Replies:** 3\
**Last updated:** [April 12, 2021, 7:34am UTC](https://discourse.processing.org/t/p5-instance-mode-syntax-question-createinput-constantly-gets-errord-not-defined/29206 "2021-04-12T07:34:48Z")

</div>

Hello I have an instanced version of p5.js on my site. I am trying to get a canvas with a createInput method to accept some input from user. This is how it’s defined var sketch3 = function( controller ) { controlle…

---

## [Help understanding Instance mode vs "normal mode"](https://discourse.processing.org/t/help-understanding-instance-mode-vs-normal-mode/29262)

<div class="topic-metadata">

**Author:** [@edufissure](https://discourse.processing.org/u/edufissure)\
**Replies:** 3\
**Last updated:** [April 11, 2021, 9:05am UTC](https://discourse.processing.org/t/help-understanding-instance-mode-vs-normal-mode/29262 "2021-04-11T09:05:03Z")

</div>

please format code with \</\> button \* homework policy \* asking questions So i dont understand why to use instance mode. First i thought that putting “myContainer” i could add class and css position and integrate in a …

---

## [Canvas doesn't show on mobile](https://discourse.processing.org/t/canvas-doesnt-show-on-mobile/29250)

<div class="topic-metadata">

**Author:** [@loopy](https://discourse.processing.org/u/loopy)\
**Replies:** 1\
**Last updated:** [April 10, 2021, 2:03pm UTC](https://discourse.processing.org/t/canvas-doesnt-show-on-mobile/29250 "2021-04-10T14:03:29Z")

</div>

Hi everyone! I recently published a background creation app and I’m confused about its canvas behavior, namely that the canvas sometimes doesn’t display on mobile. I know it doesn’t show on my old iPhone on Safari and Fi…

---

## [Sin() cos() functions acting strangely](https://discourse.processing.org/t/sin-cos-functions-acting-strangely/29149)

<div class="topic-metadata">

**Author:** [@psemme](https://discourse.processing.org/u/psemme)\
**Replies:** 6\
**Last updated:** [April 6, 2021, 1:44pm UTC](https://discourse.processing.org/t/sin-cos-functions-acting-strangely/29149 "2021-04-06T13:44:36Z")

</div>

Hello, Can’t understand this: In one simple sketch sin(30) and cos(30) produce results that appear incorrect while the exact same code in another sketch (from the Examples section) returns the correct result. Here…

---

## [Unexpected result with random pattern](https://discourse.processing.org/t/unexpected-result-with-random-pattern/29133)

<div class="topic-metadata">

**Author:** [@xiquip](https://discourse.processing.org/u/xiquip)\
**Replies:** 5\
**Last updated:** [April 6, 2021, 10:49am UTC](https://discourse.processing.org/t/unexpected-result-with-random-pattern/29133 "2021-04-06T10:49:46Z")

</div>

Hello, I thought every time I ran the code, the black boxes would appear like this. (image 1 and 2) But they are doing it like this (image 3) or anything but this. Does anyone know why? function blacksquare1() { f…

---

## [Counter and if commands](https://discourse.processing.org/t/counter-and-if-commands/28890)

<div class="topic-metadata">

**Author:** [@xiquip](https://discourse.processing.org/u/xiquip)\
**Replies:** 6\
**Last updated:** [March 27, 2021, 1:28pm UTC](https://discourse.processing.org/t/counter-and-if-commands/28890 "2021-03-27T13:28:06Z")

</div>

Hello, does anyone know why the color of the circle does not change when I reach 100? I do not know if it is a problem with the meter or what is happening var contador; var r = 0; var g = 0; var b = 255; function s…

---

## [Begginer asks for command 'for'](https://discourse.processing.org/t/begginer-asks-for-command-for/28837)

<div class="topic-metadata">

**Author:** [@xiquip](https://discourse.processing.org/u/xiquip)\
**Replies:** 4\
**Last updated:** [March 25, 2021, 7:37pm UTC](https://discourse.processing.org/t/begginer-asks-for-command-for/28837 "2021-03-25T19:37:18Z")

</div>

I am a beginner in the world of programming and so far I have only seen how to draw basic shapes and apply color to them. I am studying a programming subject at the university, in a university degree in design and this f…

---

## [A newbie needs help](https://discourse.processing.org/t/a-newbie-needs-help/28832)

<div class="topic-metadata">

**Author:** [@xiquip](https://discourse.processing.org/u/xiquip)\
**Replies:** 5\
**Last updated:** [March 25, 2021, 5:30pm UTC](https://discourse.processing.org/t/a-newbie-needs-help/28832 "2021-03-25T17:30:01Z")

</div>

Hello Im dont have a clue about programming and at school they gave us some exercises Anyone knows how to set a random value to an alpha? For example, a circle, triangle or square. for example , I assign a variable to …

---

## [How to export Canva Render has GIF with CSS modification](https://discourse.processing.org/t/how-to-export-canva-render-has-gif-with-css-modification/28781)

<div class="topic-metadata">

**Author:** [@TuringMedia](https://discourse.processing.org/u/TuringMedia)\
**Replies:** 3\
**Last updated:** [March 24, 2021, 10:36am UTC](https://discourse.processing.org/t/how-to-export-canva-render-has-gif-with-css-modification/28781 "2021-03-24T10:36:55Z")

</div>

I’m using p5.js to make a GIF animation but I have an issue when I want to export it. I did a pixelased effect on my animation by adding these css properties to the Canva (140\*140 because I need a blur to apply image-r…

---

## [Nature of Code book (random walker)](https://discourse.processing.org/t/nature-of-code-book-random-walker/28637)

<div class="topic-metadata">

**Author:** [@Ariadne](https://discourse.processing.org/u/Ariadne)\
**Replies:** 7\
**Last updated:** [March 18, 2021, 3:13pm UTC](https://discourse.processing.org/t/nature-of-code-book-random-walker/28637 "2021-03-18T15:13:48Z")

</div>

I have been trying to follow with the Nature Of Code processing book in p5js. The following code does not work: class Walker { contructor() { this.x = 250; this.y = 250; } display() { stroke(255); …

---

## [Loading multiple models with a for loop?](https://discourse.processing.org/t/loading-multiple-models-with-a-for-loop/28395)

<div class="topic-metadata">

**Author:** [@lucienfradet](https://discourse.processing.org/u/lucienfradet)\
**Replies:** 2\
**Last updated:** [March 13, 2021, 2:20pm UTC](https://discourse.processing.org/t/loading-multiple-models-with-a-for-loop/28395 "2021-03-13T14:20:03Z")

</div>

Hello! I’m trying to load 15 different 3D models in P5 and make them appear at specific time. Is there a way to load models with a “for loop” and place the models in an array? I’m a complete beginner :confused: Here’s…

---

## [Conflict between loadShader() and p5 reference?](https://discourse.processing.org/t/conflict-between-loadshader-and-p5-reference/28402)

<div class="topic-metadata">

**Author:** [@marcela](https://discourse.processing.org/u/marcela)\
**Replies:** 2\
**Last updated:** [March 11, 2021, 12:11pm UTC](https://discourse.processing.org/t/conflict-between-loadshader-and-p5-reference/28402 "2021-03-11T12:11:05Z")

</div>

Hi everyone! I am trying to have a callback function triggered by a shader loading, but there seems to be something wrong. This is the suggested syntax in the reference: loadShader(vertFilename, fragFilename, \[callback…

---

## [How can I count the number of files in a directory?](https://discourse.processing.org/t/how-can-i-count-the-number-of-files-in-a-directory/28377)

<div class="topic-metadata">

**Author:** [@LiterallyANoodle](https://discourse.processing.org/u/LiterallyANoodle)\
**Replies:** 2\
**Last updated:** [March 10, 2021, 10:51am UTC](https://discourse.processing.org/t/how-can-i-count-the-number-of-files-in-a-directory/28377 "2021-03-10T10:51:10Z")

</div>

I’m working on a little side-project where it is necessary for me to preload several images as an array before the rest of the program runs. When this program is run in context, I won’t have any way of knowing how many i…

---

## [Dot Product Question](https://discourse.processing.org/t/dot-product-question/28351)

<div class="topic-metadata">

**Author:** [@BigBigRed](https://discourse.processing.org/u/BigBigRed)\
**Replies:** 2\
**Last updated:** [March 9, 2021, 3:06pm UTC](https://discourse.processing.org/t/dot-product-question/28351 "2021-03-09T15:06:05Z")

</div>

I am trying to understand Dot Product and how to use it. I am trying to follow/re engineer a shader that I have found. (Acid Jelly from either Shadertoy or Shaderific, I think). The line of shader code is ‘uv /= dot(u…

---

## [Converting PGraphics and Mask from Processing to p5.js](https://discourse.processing.org/t/converting-pgraphics-and-mask-from-processing-to-p5-js/28133)

<div class="topic-metadata">

**Author:** [@bdooley](https://discourse.processing.org/u/bdooley)\
**Replies:** 8\
**Last updated:** [February 28, 2021, 10:17pm UTC](https://discourse.processing.org/t/converting-pgraphics-and-mask-from-processing-to-p5-js/28133 "2021-02-28T22:17:03Z")

</div>

Is there a tag for super beginners? I currently have a simple sketch that uses a mask to reveal an image below another. For some reason once I convert to p5.js, nothing shows up. I think it might have to do with the begi…

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

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