# Coding Questions

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

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

**Page:** 20

---

## [Video loops in p5 web editor but error/not playing in VSC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028)

<div class="topic-metadata">

**Author:** [@monkey](https://discourse.processing.org/u/monkey)\
**Replies:** 5\
**Last updated:** [May 13, 2021, 3:39am UTC](https://discourse.processing.org/t/video-loops-in-p5-web-editor-but-error-not-playing-in-vsc/30028 "2021-05-13T03:39:41Z")

</div>

My p5 sketches made in web editor work perfectly. I now attempted to move them to VSC but there are issues with the video playback (either it remains frozen, or doest play back at all.) The error that I get is: Uncaug…

---

## [File save limitations](https://discourse.processing.org/t/file-save-limitations/30034)

<div class="topic-metadata">

**Author:** [@geo3geo](https://discourse.processing.org/u/geo3geo)\
**Replies:** 4\
**Last updated:** [May 11, 2021, 1:34pm UTC](https://discourse.processing.org/t/file-save-limitations/30034 "2021-05-11T13:34:37Z")

</div>

I know that for security reasons there are limitations on writing files but wonder if there any way round this. My objective is to read a file, add a line to it and then save it, with the same name. I’m using saveTable…

---

## [Having trouble understanding why the information is not being passed correctly in p5js](https://discourse.processing.org/t/having-trouble-understanding-why-the-information-is-not-being-passed-correctly-in-p5js/30010)

<div class="topic-metadata">

**Author:** [@Bife](https://discourse.processing.org/u/Bife)\
**Replies:** 1\
**Last updated:** [May 10, 2021, 7:28pm UTC](https://discourse.processing.org/t/having-trouble-understanding-why-the-information-is-not-being-passed-correctly-in-p5js/30010 "2021-05-10T19:28:42Z")

</div>

I’ll start of by posting the link to the code: https://editor.p5js.org/bsilva.aulas/sketches/T0NVv6ya4 So this was something my teacher did in one of our classes, but didn’t finish, and hasn’t gone back to it, and I’m …

---

## [Need clarification on how this piece of found code is working (recursion)](https://discourse.processing.org/t/need-clarification-on-how-this-piece-of-found-code-is-working-recursion/29969)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 5\
**Last updated:** [May 10, 2021, 4:08pm UTC](https://discourse.processing.org/t/need-clarification-on-how-this-piece-of-found-code-is-working-recursion/29969 "2021-05-10T16:08:44Z")

</div>

Hello! I am trying to understand how a sketch works that I saw on the openprocessing.org site by Naoto Hieda. The use of “level” in this sketch, I am not fully understanding. And it’s probably a very simple oversight o…

---

## [Arc in layer. How to put an arc() in a layer](https://discourse.processing.org/t/arc-in-layer-how-to-put-an-arc-in-a-layer/29991)

<div class="topic-metadata">

**Author:** [@patricio1979](https://discourse.processing.org/u/patricio1979)\
**Replies:** 9\
**Last updated:** [May 9, 2021, 10:48pm UTC](https://discourse.processing.org/t/arc-in-layer-how-to-put-an-arc-in-a-layer/29991 "2021-05-09T22:48:25Z")

</div>

let botonito, indice=-1, segmentos=\[\], global\_layer; let a,b,c,d,e,f; function setup() { var ww = windowWidth, wh = windowHeight; var wwg = ww/20, whg = wh/20; let uno = \[wwg\*8,whg\*2,wwg\*8,whg,3.14,6.28\], dos = …

---

## [Text function wrapping - Hyphens vs Full word line break](https://discourse.processing.org/t/text-function-wrapping-hyphens-vs-full-word-line-break/29975)

<div class="topic-metadata">

**Author:** [@mikthelegend](https://discourse.processing.org/u/mikthelegend)\
**Replies:** 2\
**Last updated:** [May 9, 2021, 11:12am UTC](https://discourse.processing.org/t/text-function-wrapping-hyphens-vs-full-word-line-break/29975 "2021-05-09T11:12:02Z")

</div>

Hello! I’m having trouble using the text() function in p5.js. I understand that when you provide 5 inputs to the function, the last four describe a rectangle in which it will wrap your provided string. However, in some …

---

## [Using swipe with p5.js](https://discourse.processing.org/t/using-swipe-with-p5-js/24287)

<div class="topic-metadata">

**Author:** [@BSiemens](https://discourse.processing.org/u/BSiemens)\
**Replies:** 1\
**Last updated:** [May 9, 2021, 8:27am UTC](https://discourse.processing.org/t/using-swipe-with-p5-js/24287 "2021-05-09T08:27:13Z")

</div>

Does anyone know of an example of the proper implementation of swipe left/right/up/down on mobile?

---

## [Animate vertex shapes on p5.js](https://discourse.processing.org/t/animate-vertex-shapes-on-p5-js/29966)

<div class="topic-metadata">

**Author:** [@yaelmogyoros](https://discourse.processing.org/u/yaelmogyoros)\
**Replies:** 1\
**Last updated:** [May 8, 2021, 7:54pm UTC](https://discourse.processing.org/t/animate-vertex-shapes-on-p5-js/29966 "2021-05-08T19:54:24Z")

</div>

hello everybody I have difficulty doing my homework. I need to make the tears I created using the curveVertex disappear one after the other like a timer and I tried everything everything i learned and I can’t figure ou…

---

## [Using Vertex in for loop to generate a curve](https://discourse.processing.org/t/using-vertex-in-for-loop-to-generate-a-curve/29964)

<div class="topic-metadata">

**Author:** [@ChadKagan](https://discourse.processing.org/u/ChadKagan)\
**Replies:** 4\
**Last updated:** [May 8, 2021, 8:43pm UTC](https://discourse.processing.org/t/using-vertex-in-for-loop-to-generate-a-curve/29964 "2021-05-08T20:43:27Z")

</div>

Hello, We are trying to draw a curve based on a formula that takes control points clicked on a canvas and generates a cubic B Spline curve. Our functions generate a series of points that should lie on the curve, but the…

---

## [Anyone know how to Convert p5js to processing?](https://discourse.processing.org/t/anyone-know-how-to-convert-p5js-to-processing/29952)

<div class="topic-metadata">

**Author:** [@98Mabs](https://discourse.processing.org/u/98Mabs)\
**Replies:** 2\
**Last updated:** [May 8, 2021, 8:49am UTC](https://discourse.processing.org/t/anyone-know-how-to-convert-p5js-to-processing/29952 "2021-05-08T08:49:51Z")

</div>

Hi guys, could anyone help me converting this code into Processing please? i really dont know how to convert it, and when i do it with the processing manual it doesn’t work…

---

## [P5 pixel array to copy canvas region to Image object](https://discourse.processing.org/t/p5-pixel-array-to-copy-canvas-region-to-image-object/29946)

<div class="topic-metadata">

**Author:** [@mattobject](https://discourse.processing.org/u/mattobject)\
**Replies:** 4\
**Last updated:** [May 8, 2021, 12:23am UTC](https://discourse.processing.org/t/p5-pixel-array-to-copy-canvas-region-to-image-object/29946 "2021-05-08T00:23:19Z")

</div>

Working on a project that uses the webcam, lays some graphics on top of the cam image, then I need to store the cam image with the overlayed graphics in an Image object variable. Currently, my code works but the resultin…

---

## [How can I use p5.js sketch as loader for website?](https://discourse.processing.org/t/how-can-i-use-p5-js-sketch-as-loader-for-website/29890)

<div class="topic-metadata">

**Author:** [@cn13](https://discourse.processing.org/u/cn13)\
**Replies:** 10\
**Last updated:** [May 7, 2021, 5:46am UTC](https://discourse.processing.org/t/how-can-i-use-p5-js-sketch-as-loader-for-website/29890 "2021-05-07T05:46:35Z")

</div>

hi there, i have created a p5.js sketch and tried to implement it on my website as a loader… the problem is, that i have to load the p5.js sketch in the body part of my HTML because the sketch would still be visible aft…

---

## [How to assign HTML input forms to p5 variables?](https://discourse.processing.org/t/how-to-assign-html-input-forms-to-p5-variables/29915)

<div class="topic-metadata">

**Author:** [@Gershy13](https://discourse.processing.org/u/Gershy13)\
**Replies:** 2\
**Last updated:** [May 7, 2021, 12:30am UTC](https://discourse.processing.org/t/how-to-assign-html-input-forms-to-p5-variables/29915 "2021-05-07T00:30:16Z")

</div>

Hi, so ive just integrated my p5 sketch into my website which already has the gui made (buttons, sliders, color pickers etc) using HTML5/ standard HTML input modes. Im trying to figure out a way to link those inputs to …

---

## [I would love some help on this code I am extremely stuck](https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858)

<div class="topic-metadata">

**Author:** [@yoda9633](https://discourse.processing.org/u/yoda9633)\
**Replies:** 3\
**Last updated:** [May 4, 2021, 9:39pm UTC](https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858 "2021-05-04T21:39:10Z")

</div>

I can’t get the square to go with the coordinate. I don’t know why its not syncing.

---

## [Cannot read property 'x' of undefined. Problem reading parameters of vector](https://discourse.processing.org/t/cannot-read-property-x-of-undefined-problem-reading-parameters-of-vector/29831)

<div class="topic-metadata">

**Author:** [@Kentucky](https://discourse.processing.org/u/Kentucky)\
**Replies:** 2\
**Last updated:** [May 4, 2021, 7:48am UTC](https://discourse.processing.org/t/cannot-read-property-x-of-undefined-problem-reading-parameters-of-vector/29831 "2021-05-04T07:48:13Z")

</div>

Hello everybody, this is my first post so I hope everything is correct. I’m having trouble with the function pathFunction() (towards the end). What I want to do is to store the vector this.pos in the array “path” and th…

---

## [Avoid csv overlaps for website project](https://discourse.processing.org/t/avoid-csv-overlaps-for-website-project/29723)

<div class="topic-metadata">

**Author:** [@OptOut](https://discourse.processing.org/u/OptOut)\
**Replies:** 14\
**Last updated:** [May 2, 2021, 3:42pm UTC](https://discourse.processing.org/t/avoid-csv-overlaps-for-website-project/29723 "2021-05-02T15:42:30Z")

</div>

Hi everybody, I am starting a project that I want to be able to do/be the following: A single web page with three columns and many (thousands) of rows and many cells. the text based information in each cell will be fr…

---

## [How to improve my sketch board?](https://discourse.processing.org/t/how-to-improve-my-sketch-board/29698)

<div class="topic-metadata">

**Author:** [@turtle](https://discourse.processing.org/u/turtle)\
**Replies:** 4\
**Last updated:** [April 28, 2021, 1:05pm UTC](https://discourse.processing.org/t/how-to-improve-my-sketch-board/29698 "2021-04-28T13:05:34Z")

</div>

Yes, I am creating one sketch board for my students. At this moment, the sketch board is so simple just with Stroke, ColorPicker, Eraser, and one Clear button, the code is following: document.oncontextmenu=new Functio…

---

## [orbitControl() only works after a double tap (mobile)](https://discourse.processing.org/t/orbitcontrol-only-works-after-a-double-tap-mobile/29661)

<div class="topic-metadata">

**Author:** [@andypurbrick](https://discourse.processing.org/u/andypurbrick)\
**Replies:** 6\
**Last updated:** [April 28, 2021, 11:12am UTC](https://discourse.processing.org/t/orbitcontrol-only-works-after-a-double-tap-mobile/29661 "2021-04-28T11:12:21Z")

</div>

I have a sketch with a rotating cube that uses the orbitControl() to allow it to be moved on its X axis, however, orbit controls only work if I double tap the screen. As far as I’m aware this is not expected behaviour f…

---

## [Trig question re line/circle intersections](https://discourse.processing.org/t/trig-question-re-line-circle-intersections/29671)

<div class="topic-metadata">

**Author:** [@psemme](https://discourse.processing.org/u/psemme)\
**Replies:** 5\
**Last updated:** [April 28, 2021, 7:17am UTC](https://discourse.processing.org/t/trig-question-re-line-circle-intersections/29671 "2021-04-28T07:17:23Z")

</div>

I never really grok’d trig in school but have enjoyed learning it now as I’m older. And I stumble onto things that I really feel should have simple solutions but I end up staring at them for hours because I don’t have t…

---

## [How to change image on mouse click](https://discourse.processing.org/t/how-to-change-image-on-mouse-click/29692)

<div class="topic-metadata">

**Author:** [@ccotto](https://discourse.processing.org/u/ccotto)\
**Replies:** 6\
**Last updated:** [April 28, 2021, 12:12am UTC](https://discourse.processing.org/t/how-to-change-image-on-mouse-click/29692 "2021-04-28T00:12:32Z")

</div>

How do I change an image (of fruit) each time the user clicks on it with their mouse? This is for a drawing app where the user selects ‘brushes’ to draw on the screen with their mouse. /\* global createCanvas, resizeCanv…

---

## [Cant figure this out/help with code ASAP](https://discourse.processing.org/t/cant-figure-this-out-help-with-code-asap/29686)

<div class="topic-metadata">

**Author:** [@Astromdahl01](https://discourse.processing.org/u/Astromdahl01)\
**Replies:** 3\
**Last updated:** [April 27, 2021, 8:53pm UTC](https://discourse.processing.org/t/cant-figure-this-out-help-with-code-asap/29686 "2021-04-27T20:53:12Z")

</div>

Hello, I need Help with some code, I want The record to move around freely on the canvas and go to a random x and y and repeat constantly. is there a way I can do this? here is the link to y project https://editor.p5js.…

---

## [All codes seem to be correct, but no response from system](https://discourse.processing.org/t/all-codes-seem-to-be-correct-but-no-response-from-system/29665)

<div class="topic-metadata">

**Author:** [@JustinChan613](https://discourse.processing.org/u/JustinChan613)\
**Replies:** 4\
**Last updated:** [April 27, 2021, 9:47am UTC](https://discourse.processing.org/t/all-codes-seem-to-be-correct-but-no-response-from-system/29665 "2021-04-27T09:47:22Z")

</div>

Still working on the tic tac toe, I have almost done the whole coding. Right now I am working on the random picking of players. When even the console.log is working, there is no response from the system. Would like to as…

---

## [Trouble configuring bezier start and end points for uniform arc](https://discourse.processing.org/t/trouble-configuring-bezier-start-and-end-points-for-uniform-arc/29643)

<div class="topic-metadata">

**Author:** [@psemme](https://discourse.processing.org/u/psemme)\
**Replies:** 9\
**Last updated:** [April 27, 2021, 2:05am UTC](https://discourse.processing.org/t/trouble-configuring-bezier-start-and-end-points-for-uniform-arc/29643 "2021-04-27T02:05:04Z")

</div>

I’d like to create a shape that is, in essence, two, uniform concentric arcs connected by lines (radius segments) so that I can fill them individually. I’ve come close to doing it with Bezier curves but it’s still not ri…

---

## [Boolean (CSG union, intersect, etc) 3D shapes into p5js model](https://discourse.processing.org/t/boolean-csg-union-intersect-etc-3d-shapes-into-p5js-model/29613)

<div class="topic-metadata">

**Author:** [@ffd8](https://discourse.processing.org/u/ffd8)\
**Replies:** 10\
**Last updated:** [April 26, 2021, 8:04pm UTC](https://discourse.processing.org/t/boolean-csg-union-intersect-etc-3d-shapes-into-p5js-model/29613 "2021-04-26T20:04:46Z")

</div>

A few years ago a feature request on p5.js’ github asked about boolean 3d modeling – which was determined to be best added as a library. Researching the topic now with a student and that thread informed us about CSG, sp…

---

## [Unexpected behaviour with select method in instance mode](https://discourse.processing.org/t/unexpected-behaviour-with-select-method-in-instance-mode/29612)

<div class="topic-metadata">

**Author:** [@afkqs](https://discourse.processing.org/u/afkqs)\
**Replies:** 7\
**Last updated:** [April 25, 2021, 10:15pm UTC](https://discourse.processing.org/t/unexpected-behaviour-with-select-method-in-instance-mode/29612 "2021-04-25T22:15:18Z")

</div>

Hi there, I started a project that uses p5.js in instance mode and I’m encountering a weird behaviour when I try to use the select() method. In some cases, when I try to select an element in the DOM using that function…

---

## [Troubleshooting converting from .pde to p5 sketch](https://discourse.processing.org/t/troubleshooting-converting-from-pde-to-p5-sketch/29617)

<div class="topic-metadata">

**Author:** [@stanley](https://discourse.processing.org/u/stanley)\
**Replies:** 2\
**Last updated:** [April 25, 2021, 10:15am UTC](https://discourse.processing.org/t/troubleshooting-converting-from-pde-to-p5-sketch/29617 "2021-04-25T10:15:29Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi all, I have a Processing sketch that I need to be converted to p5.js. I’ve never used p5 or javascript before so it has become a bit more inv…

---

## [P5.js code for creating a calculator tip app confused](https://discourse.processing.org/t/p5-js-code-for-creating-a-calculator-tip-app-confused/29219)

<div class="topic-metadata">

**Author:** [@rodeodash832](https://discourse.processing.org/u/rodeodash832)\
**Replies:** 34\
**Last updated:** [April 23, 2021, 8:02am UTC](https://discourse.processing.org/t/p5-js-code-for-creating-a-calculator-tip-app-confused/29219 "2021-04-23T08:02:19Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Just confused on how I would make this instruction given: You are going to create an app to help you determine what percentage you should tip s…

---

## [Functions cannot load (Tic tac toe)](https://discourse.processing.org/t/functions-cannot-load-tic-tac-toe/29561)

<div class="topic-metadata">

**Author:** [@JustinChan613](https://discourse.processing.org/u/JustinChan613)\
**Replies:** 4\
**Last updated:** [April 22, 2021, 7:02pm UTC](https://discourse.processing.org/t/functions-cannot-load-tic-tac-toe/29561 "2021-04-22T19:02:19Z")

</div>

Hi all I am continuing my tic tac toe project while I meet another problem. When I load the functions, the system keeps responding ‘Uncaught RangeError: Maximum call stack size exceeded’ or ‘Cannot read property ‘NaN’ of…

---

## [Overlayed Transparent Shapes Never Become Fully Opaque](https://discourse.processing.org/t/overlayed-transparent-shapes-never-become-fully-opaque/29518)

<div class="topic-metadata">

**Author:** [@kweso](https://discourse.processing.org/u/kweso)\
**Replies:** 7\
**Last updated:** [April 22, 2021, 12:12am UTC](https://discourse.processing.org/t/overlayed-transparent-shapes-never-become-fully-opaque/29518 "2021-04-22T00:12:13Z")

</div>

Why do the overlaying circles in the bg never become the full color of the circle in the middle? Very low alpha values (\<5) even change the saturation of my color… Is there anything for me to fix this? Tyvm!

---

## [Problem on If-else statement](https://discourse.processing.org/t/problem-on-if-else-statement/29546)

<div class="topic-metadata">

**Author:** [@JustinChan613](https://discourse.processing.org/u/JustinChan613)\
**Replies:** 4\
**Last updated:** [April 21, 2021, 5:03pm UTC](https://discourse.processing.org/t/problem-on-if-else-statement/29546 "2021-04-21T17:03:31Z")

</div>

Hi All I am now doing a project on p5.js gaming. As I want to do random picking on CPU/Player playing first, I am using the concept of random( ) and if-else statement. However, it does not work. Would like to ask what is…

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

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