# Coding Questions

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

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

**Page:** 42

---

## [Loosing quality using createGraphics](https://discourse.processing.org/t/loosing-quality-using-creategraphics/12279)

<div class="topic-metadata">

**Author:** [@josebv](https://discourse.processing.org/u/josebv)\
**Replies:** 1\
**Last updated:** [July 1, 2019, 1:40pm UTC](https://discourse.processing.org/t/loosing-quality-using-creategraphics/12279 "2019-07-01T13:40:28Z")

</div>

Hi, first of all I wanna clarify that im a noob. Im trying to make a program like notability using p5.js Ive been using the p5 web editor but know im using vs code (don’t think is relevant) the problem is that, I don’…

---

## [How would you get two separate sketches to interact?](https://discourse.processing.org/t/how-would-you-get-two-separate-sketches-to-interact/12368)

<div class="topic-metadata">

**Author:** [@KeirMeDear](https://discourse.processing.org/u/KeirMeDear)\
**Replies:** 3\
**Last updated:** [June 30, 2019, 11:41pm UTC](https://discourse.processing.org/t/how-would-you-get-two-separate-sketches-to-interact/12368 "2019-06-30T23:41:32Z")

</div>

Theoretically, how would you get two separate sketches to work together on the same website. For example, I am looking at having two sketches, one in 2d processing as a control system and the second in 3d processing as …

---

## [Object moves when .move function not called](https://discourse.processing.org/t/object-moves-when-move-function-not-called/12391)

<div class="topic-metadata">

**Author:** [@itch](https://discourse.processing.org/u/itch)\
**Replies:** 3\
**Last updated:** [June 30, 2019, 4:39pm UTC](https://discourse.processing.org/t/object-moves-when-move-function-not-called/12391 "2019-06-30T16:39:57Z")

</div>

Hello everyone, I’m attempting to simulate a light clock a la Einstein’s famous though experiment in p5. I’ve made mirror and photon objects, and have utilised those in a meta-object called “clock”. I want to have one…

---

## [How to use tint() with copy()](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359)

<div class="topic-metadata">

**Author:** [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Replies:** 7\
**Last updated:** [June 28, 2019, 6:05pm UTC](https://discourse.processing.org/t/how-to-use-tint-with-copy/12359 "2019-06-28T18:05:13Z")

</div>

To put a tint on an image you use the tint function followed by the image function like so: tint(255, 0, 0); image(img, 0, 0); //red image But when I try to use the copy function, the tint isn’t applied as it is only e…

---

## [Unwanted scrollbar showing because of canvas](https://discourse.processing.org/t/unwanted-scrollbar-showing-because-of-canvas/12214)

<div class="topic-metadata">

**Author:** [@Halhex](https://discourse.processing.org/u/Halhex)\
**Replies:** 8\
**Last updated:** [June 28, 2019, 5:51pm UTC](https://discourse.processing.org/t/unwanted-scrollbar-showing-because-of-canvas/12214 "2019-06-28T17:51:27Z")

</div>

I am creating a simple p5.js canvas using the values from it’s parent, which takes up exactly half the screen. When I add the canvas which has the exact size as my html , body and #musicscape elements, a vertical scr…

---

## [Copying a color](https://discourse.processing.org/t/copying-a-color/12312)

<div class="topic-metadata">

**Author:** [@marcusround](https://discourse.processing.org/u/marcusround)\
**Replies:** 4\
**Last updated:** [June 27, 2019, 9:08am UTC](https://discourse.processing.org/t/copying-a-color/12312 "2019-06-27T09:08:52Z")

</div>

Is this the best/most succinct way of copying a color? c2 = color( red(c1), green(c1), blue(c1), alpha(c1) ) I wish I could just do c2 = c1.copy() or something like that, which you can do with vectors.

---

## [If else statement not working](https://discourse.processing.org/t/if-else-statement-not-working/12325)

<div class="topic-metadata">

**Author:** [@julan](https://discourse.processing.org/u/julan)\
**Replies:** 2\
**Last updated:** [June 27, 2019, 6:04am UTC](https://discourse.processing.org/t/if-else-statement-not-working/12325 "2019-06-27T06:04:20Z")

</div>

hey, I am a beginner and wanted to made this sketch of a ball that squishes before it bounces back, hover it doesn’t squisches at al and I don’t get the squishing part of the sketch to work without removing all of the m…

---

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

<div class="topic-metadata">

**Author:** [@PixelMx](https://discourse.processing.org/u/PixelMx)\
**Replies:** 3\
**Last updated:** [June 26, 2019, 9:29pm UTC](https://discourse.processing.org/t/help-what-am-i-missing/12241 "2019-06-26T21:29:03Z")

</div>

hello everyone. I’ve been asking a lot of questions lately, I’m learning to code by copying. Last night I found a sketch in openprocessing that I liked that it was created with P5, I thought translating was a good exerc…

---

## [Pause Line Execution Until Condition Happens in P5](https://discourse.processing.org/t/pause-line-execution-until-condition-happens-in-p5/11910)

<div class="topic-metadata">

**Author:** [@zinsy23](https://discourse.processing.org/u/zinsy23)\
**Replies:** 9\
**Last updated:** [June 25, 2019, 11:24am UTC](https://discourse.processing.org/t/pause-line-execution-until-condition-happens-in-p5/11910 "2019-06-25T11:24:33Z")

</div>

I am making an abacus simulator in p5 (sketch file) that does all the moves step by step. To animate the movement, I have variable x incrementally increase/decrease in a show function I created (lines 166 and 172), which…

---

## [P5.js Object array of title names are not being recognized](https://discourse.processing.org/t/p5-js-object-array-of-title-names-are-not-being-recognized/12224)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 4\
**Last updated:** [June 21, 2019, 5:57am UTC](https://discourse.processing.org/t/p5-js-object-array-of-title-names-are-not-being-recognized/12224 "2019-06-21T05:57:05Z")

</div>

Before adding the stars I’m trying to figure out why the titles are not appearing on the book objects. I’m sure it’s a simple oversight on my part, but if anyone can help it is sincerely appreciated! var myBooks = \[ { …

---

## [Input Field and Button not working in android mobile](https://discourse.processing.org/t/input-field-and-button-not-working-in-android-mobile/12203)

<div class="topic-metadata">

**Author:** [@Kabir](https://discourse.processing.org/u/Kabir)\
**Replies:** 0\
**Last updated:** [June 20, 2019, 2:00pm UTC](https://discourse.processing.org/t/input-field-and-button-not-working-in-android-mobile/12203 "2019-06-20T14:00:59Z")

</div>

I made a github page of my p5.js sketches. Some of my programs required text input from the user. So I used createInput() and createButton() function like in this one https://road-coders.github.io/Factorial/index.html. I…

---

## [Is this a bug, if statement validation Djikstra](https://discourse.processing.org/t/is-this-a-bug-if-statement-validation-djikstra/12184)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 7\
**Last updated:** [June 19, 2019, 9:21pm UTC](https://discourse.processing.org/t/is-this-a-bug-if-statement-validation-djikstra/12184 "2019-06-19T21:21:40Z")

</div>

I’m coding a djiktsra search algorithm however I wanted to improve the last bit my programs algorithm and again run into some if statement issues, not sure if this is a bug or not. https://editor.p5js.org/paulgoux/sketc…

---

## [Help understanding properties](https://discourse.processing.org/t/help-understanding-properties/12108)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 1\
**Last updated:** [June 17, 2019, 8:34pm UTC](https://discourse.processing.org/t/help-understanding-properties/12108 "2019-06-17T20:34:17Z")

</div>

I’m trying to understand the behavior of properties in this function. I’ve created entirely by accident, or rather I have not read any documentation prior to coding this. I know vaguely how properties work, but the behav…

---

## [Html contdown timer](https://discourse.processing.org/t/html-contdown-timer/12123)

<div class="topic-metadata">

**Author:** [@Elite](https://discourse.processing.org/u/Elite)\
**Replies:** 1\
**Last updated:** [June 17, 2019, 8:31pm UTC](https://discourse.processing.org/t/html-contdown-timer/12123 "2019-06-17T20:31:29Z")

</div>

Hello, i want to set a timer on my html website that can use a selected value as the counter value, i created a js code that runs the timer but everytime i reload it, it runs the timer again. HTML \<select name="ddsele…

---

## [Understanding paint depth & opacity in p5js & webgl](https://discourse.processing.org/t/understanding-paint-depth-opacity-in-p5js-webgl/12046)

<div class="topic-metadata">

**Author:** [@jedierikb](https://discourse.processing.org/u/jedierikb)\
**Replies:** 2\
**Last updated:** [June 15, 2019, 5:58pm UTC](https://discourse.processing.org/t/understanding-paint-depth-opacity-in-p5js-webgl/12046 "2019-06-15T17:58:15Z")

</div>

https://codepen.io/jedierikb/pen/EBVyPE?editors=1010 In this example, I am confused that the green plane is over the red plane when on the right side of the sketch. If I change the opacity of the planes to 100%, then I…

---

## [How to use mousePressed with mouseX and mouseY?](https://discourse.processing.org/t/how-to-use-mousepressed-with-mousex-and-mousey/12000)

<div class="topic-metadata">

**Author:** [@carriemarrie](https://discourse.processing.org/u/carriemarrie)\
**Replies:** 2\
**Last updated:** [June 14, 2019, 11:02pm UTC](https://discourse.processing.org/t/how-to-use-mousepressed-with-mousex-and-mousey/12000 "2019-06-14T23:02:40Z")

</div>

I have 6 different objects and I’d like to choose one of the objects and move it to the next screen. Right now there is just 3D box on the next screen. But I don’t know how to do it. Any help would be needed! Here’s the…

---

## [Issues with panning & checking for visibility on a translated canvas?](https://discourse.processing.org/t/issues-with-panning-checking-for-visibility-on-a-translated-canvas/12006)

<div class="topic-metadata">

**Author:** [@Tinstar](https://discourse.processing.org/u/Tinstar)\
**Replies:** 2\
**Last updated:** [June 14, 2019, 7:06pm UTC](https://discourse.processing.org/t/issues-with-panning-checking-for-visibility-on-a-translated-canvas/12006 "2019-06-14T19:06:14Z")

</div>

I originally posted this on Stack Overflow via the p5 tag, but figured this might be a better place for it. I’m working on getting 2D zooming and panning working in a p5 project, a la this example code. I’m working in i…

---

## [How to use split screen video sections as textures?](https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463)

<div class="topic-metadata">

**Author:** [@jedierikb](https://discourse.processing.org/u/jedierikb)\
**Replies:** 3\
**Last updated:** [June 13, 2019, 4:54pm UTC](https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463 "2019-06-13T16:54:34Z")

</div>

Here is what I am trying to do: load one split screen video (for example https://www.youtube.com/watch?v=5eEXKzbeH7c ) and then use either side of the video as a texture for two different GL shapes. Hoping the community…

---

## [Mouse relative to Translations and Scale](https://discourse.processing.org/t/mouse-relative-to-translations-and-scale/11976)

<div class="topic-metadata">

**Author:** [@oOoOoO](https://discourse.processing.org/u/oOoOoO)\
**Replies:** 2\
**Last updated:** [June 12, 2019, 6:29pm UTC](https://discourse.processing.org/t/mouse-relative-to-translations-and-scale/11976 "2019-06-12T18:29:57Z")

</div>

Hello. I am trying to access the mouse position through mouseX and mouseY within a keypressed function, but I have translations and scales in the draw function of my sketch, and I think this is causing me to get a mouse …

---

## [Trying to create wave / cloth flow pattern](https://discourse.processing.org/t/trying-to-create-wave-cloth-flow-pattern/11795)

<div class="topic-metadata">

**Author:** [@noob](https://discourse.processing.org/u/noob)\
**Replies:** 10\
**Last updated:** [June 12, 2019, 2:37am UTC](https://discourse.processing.org/t/trying-to-create-wave-cloth-flow-pattern/11795 "2019-06-12T02:37:46Z")

</div>

Hello good people! I found this picture in the internet few weeks ago: and I have been trying to replicate this in p5.js but haven’t found the solution yet. This is my code: var woll = \[\]; function setup() { cre…

---

## [Change shape of color brightness](https://discourse.processing.org/t/change-shape-of-color-brightness/11030)

<div class="topic-metadata">

**Author:** [@hamzakhan](https://discourse.processing.org/u/hamzakhan)\
**Replies:** 4\
**Last updated:** [June 10, 2019, 11:33am UTC](https://discourse.processing.org/t/change-shape-of-color-brightness/11030 "2019-06-10T11:33:41Z")

</div>

How we can change shape of color brightness of below tutorial ? https://p5js.org/examples/color-brightness.html

---

## [Tentacles renders on polar to cartersian all out of whack](https://discourse.processing.org/t/tentacles-renders-on-polar-to-cartersian-all-out-of-whack/11957)

<div class="topic-metadata">

**Author:** [@Arif](https://discourse.processing.org/u/Arif)\
**Replies:** 1\
**Last updated:** [June 10, 2019, 6:22am UTC](https://discourse.processing.org/t/tentacles-renders-on-polar-to-cartersian-all-out-of-whack/11957 "2019-06-10T06:22:26Z")

</div>

Hey There, I just recently found p5.js and have gone through a whole bunch of tutorial videos by Daniel Shiffman. I have managed to Frankenstein this together. My goal is to have the tentacles hang on the vertices of t…

---

## [If/else statement not evaluating](https://discourse.processing.org/t/if-else-statement-not-evaluating/11927)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 3\
**Last updated:** [June 9, 2019, 7:47pm UTC](https://discourse.processing.org/t/if-else-statement-not-evaluating/11927 "2019-06-09T19:47:05Z")

</div>

I’m trying to automate the maze search I’ve created (I know I keep posting about this one). So weird issue, I need to test if the paths have been explored so I created a variable that can be updated every time there is n…

---

## [Need help! Beginner! How to capture image and use the image](https://discourse.processing.org/t/need-help-beginner-how-to-capture-image-and-use-the-image/11937)

<div class="topic-metadata">

**Author:** [@carriemarrie](https://discourse.processing.org/u/carriemarrie)\
**Replies:** 1\
**Last updated:** [June 9, 2019, 7:38am UTC](https://discourse.processing.org/t/need-help-beginner-how-to-capture-image-and-use-the-image/11937 "2019-06-09T07:38:26Z")

</div>

Hello! I am trying to make an app for my first coding course but I am having some problems. By far I have made the first page, using camera and saving the picture. But my next step would be to USE the image that I took a…

---

## [Using splice in an enhanced for loop](https://discourse.processing.org/t/using-splice-in-an-enhanced-for-loop/11931)

<div class="topic-metadata">

**Author:** [@ZachMcMkay](https://discourse.processing.org/u/ZachMcMkay)\
**Replies:** 1\
**Last updated:** [June 8, 2019, 8:26pm UTC](https://discourse.processing.org/t/using-splice-in-an-enhanced-for-loop/11931 "2019-06-08T20:26:20Z")

</div>

Is there an issue with splice not working properly when running an enhanced for loop? this is my code. for (p of pieces) { for (other of pieces) { if (p != other && p.col != other.col && p.capture(other)) { co…

---

## [Neophyte needs help converting P5 code to Processing](https://discourse.processing.org/t/neophyte-needs-help-converting-p5-code-to-processing/11884)

<div class="topic-metadata">

**Author:** [@lfb](https://discourse.processing.org/u/lfb)\
**Replies:** 12\
**Last updated:** [June 8, 2019, 7:24pm UTC](https://discourse.processing.org/t/neophyte-needs-help-converting-p5-code-to-processing/11884 "2019-06-08T19:24:16Z")

</div>

Hello, friends. I have a small P5 sketch that I want to convert to Processing. I’ve tried, I’ve tried but can’t bring it home. Getting frustrated. The problem happens mainly in one function that converts a string of 12 c…

---

## [Image not loading](https://discourse.processing.org/t/image-not-loading/11892)

<div class="topic-metadata">

**Author:** [@CodingIsLife](https://discourse.processing.org/u/CodingIsLife)\
**Replies:** 8\
**Last updated:** [June 8, 2019, 7:54am UTC](https://discourse.processing.org/t/image-not-loading/11892 "2019-06-08T07:54:31Z")

</div>

I loaded a local image in the preload() function. When I opened the sketch in chrome it says Loading… and in the console it says some weird message - access to image at is from origin ‘null’ has been blocked by CORS po…

---

## [Dragging and dropping an object](https://discourse.processing.org/t/dragging-and-dropping-an-object/11917)

<div class="topic-metadata">

**Author:** [@ZachMcMkay](https://discourse.processing.org/u/ZachMcMkay)\
**Replies:** 2\
**Last updated:** [June 8, 2019, 7:22am UTC](https://discourse.processing.org/t/dragging-and-dropping-an-object/11917 "2019-06-08T07:22:12Z")

</div>

Hello! im trying to create a game where i can pick up a piece move it and then drop it where i want. I’ve run into a wall trying to logically think about dropping the piece. in order to pick it up and move it by having…

---

## [Need help with texture](https://discourse.processing.org/t/need-help-with-texture/11881)

<div class="topic-metadata">

**Author:** [@Sudev](https://discourse.processing.org/u/Sudev)\
**Replies:** 0\
**Last updated:** [June 6, 2019, 11:57am UTC](https://discourse.processing.org/t/need-help-with-texture/11881 "2019-06-06T11:57:01Z")

</div>

Is there a way to repeat and offset the texture for 2d primitive shapes in WEBGL mode ? Right now I can only think of creating texture using createGraphics and applying offset in it.

---

## [P5.js to Processing conversion](https://discourse.processing.org/t/p5-js-to-processing-conversion/11789)

<div class="topic-metadata">

**Author:** [@camiloegea](https://discourse.processing.org/u/camiloegea)\
**Replies:** 2\
**Last updated:** [June 5, 2019, 9:24pm UTC](https://discourse.processing.org/t/p5-js-to-processing-conversion/11789 "2019-06-05T21:24:27Z")

</div>

Hi everyone, i´m new to java and i´m trying to convert this js code to processing, because I want it to interact with the OpenKinect Library: var img, car; function preload() { img = loadImage('faustocartel.png'); } …

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

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