# Coding Questions

**URL:** https://discourse.processing.org/c/processing/processing-questions/15.md?page=39

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

**Page:** 40

---

## [Line loop to create volume](https://discourse.processing.org/t/line-loop-to-create-volume/33447)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 9\
**Last updated:** [November 13, 2021, 4:49pm UTC](https://discourse.processing.org/t/line-loop-to-create-volume/33447 "2021-11-13T16:49:30Z")

</div>

Hi there! I am practising with loops and I would like to create something similar to the black picture attached. I have made a loop and I have made this: As you can see, I would need: To increase gradually the …

---

## [Creating a death animation for snake](https://discourse.processing.org/t/creating-a-death-animation-for-snake/33475)

<div class="topic-metadata">

**Author:** [@Addvac](https://discourse.processing.org/u/Addvac)\
**Replies:** 0\
**Last updated:** [November 12, 2021, 2:47pm UTC](https://discourse.processing.org/t/creating-a-death-animation-for-snake/33475 "2021-11-12T14:47:16Z")

</div>

//Defining necessary variables and arrays ArrayList\<Integer\> x = new ArrayList\<Integer\>(), y = new ArrayList\<Integer\>(); //creates array lists for the x and y positions of the snake int …

---

## [Help with incorporating mic inputs into my visuals](https://discourse.processing.org/t/help-with-incorporating-mic-inputs-into-my-visuals/33448)

<div class="topic-metadata">

**Author:** [@YourLocalGrandma](https://discourse.processing.org/u/YourLocalGrandma)\
**Replies:** 0\
**Last updated:** [November 10, 2021, 9:46pm UTC](https://discourse.processing.org/t/help-with-incorporating-mic-inputs-into-my-visuals/33448 "2021-11-10T21:46:45Z")

</div>

Hi Guys, would love it if someone could point me in the right direction here because I’m very stuck. My goal is to use the mic inputs to move the amplitude of the lines across the screen, creating sort of a sound visuali…

---

## [No idea what happened, getting a weird effect](https://discourse.processing.org/t/no-idea-what-happened-getting-a-weird-effect/33459)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 0\
**Last updated:** [November 11, 2021, 2:24pm UTC](https://discourse.processing.org/t/no-idea-what-happened-getting-a-weird-effect/33459 "2021-11-11T14:24:24Z")

</div>

int x = 10; int y = 10; int spacingX = 10; int spacingY = 10; int scalingNot = 255; void setup() { size(500, 500); } void draw () { background(255); for (int x = 0; x \< width; x = x + spacingX) { for (int y = 0; …

---

## [Text following a sine wave pattern](https://discourse.processing.org/t/text-following-a-sine-wave-pattern/33453)

<div class="topic-metadata">

**Author:** [@clintonva32](https://discourse.processing.org/u/clintonva32)\
**Replies:** 3\
**Last updated:** [November 11, 2021, 11:02am UTC](https://discourse.processing.org/t/text-following-a-sine-wave-pattern/33453 "2021-11-11T11:02:20Z")

</div>

Hi. Trying to get some help with this code. Pretty much want to have each letter in the string be a part of a sine wave. Any idea how to do this? My code seems to be stacking each letter on top of each other. Might be th…

---

## [My side scroller has a problem finding where the ground is](https://discourse.processing.org/t/my-side-scroller-has-a-problem-finding-where-the-ground-is/33444)

<div class="topic-metadata">

**Author:** [@DividedRabbit](https://discourse.processing.org/u/DividedRabbit)\
**Replies:** 4\
**Last updated:** [November 11, 2021, 6:41am UTC](https://discourse.processing.org/t/my-side-scroller-has-a-problem-finding-where-the-ground-is/33444 "2021-11-11T06:41:16Z")

</div>

https://drive.google.com/drive/folders/1qZGnHtEltQCCeqCsDzOSHIyZKUQMSOJt?usp=sharing Here is the drive with all of my code. I am trying to use a linear equation to determine the height of the ground, but for some reason…

---

## [Getting yellow color despite only entering one value on fill()](https://discourse.processing.org/t/getting-yellow-color-despite-only-entering-one-value-on-fill/33446)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 3\
**Last updated:** [November 10, 2021, 8:43pm UTC](https://discourse.processing.org/t/getting-yellow-color-despite-only-entering-one-value-on-fill/33446 "2021-11-10T20:43:10Z")

</div>

int x = 10; int y = 10; int spacingX = 10; int spacingY = 10; void setup() { size(500, 500); } void draw () { background(255); for (int x = 0; x \< width; x = x + spacingX) { for (int y = 0; y \< height; y = y + sp…

---

## [Grid of rectangles produces weird triangle pattern](https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432)

<div class="topic-metadata">

**Author:** [@UnusualUsual](https://discourse.processing.org/u/UnusualUsual)\
**Replies:** 3\
**Last updated:** [November 10, 2021, 5:29pm UTC](https://discourse.processing.org/t/grid-of-rectangles-produces-weird-triangle-pattern/33432 "2021-11-10T17:29:55Z")

</div>

I’m creating a grid of black rectangles on a white background and for some reason unknown to me, part of some rectangles are split and pushed up a pixel to make a weird triangle looking thing in the middle of the grid. …

---

## [Ball Collision with Box: Booleans](https://discourse.processing.org/t/ball-collision-with-box-booleans/33392)

<div class="topic-metadata">

**Author:** [@Chels](https://discourse.processing.org/u/Chels)\
**Replies:** 1\
**Last updated:** [November 8, 2021, 8:09am UTC](https://discourse.processing.org/t/ball-collision-with-box-booleans/33392 "2021-11-08T08:09:27Z")

</div>

So I have my ball restarting on the left once it collides to the right side of the screen. I added a red square in the center of the screen and I want the color of the square to change green when the ball touches the squ…

---

## [How to set the frequency of loaddata requests](https://discourse.processing.org/t/how-to-set-the-frequency-of-loaddata-requests/33442)

<div class="topic-metadata">

**Author:** [@Arabesque0210](https://discourse.processing.org/u/Arabesque0210)\
**Replies:** 0\
**Last updated:** [November 10, 2021, 2:48pm UTC](https://discourse.processing.org/t/how-to-set-the-frequency-of-loaddata-requests/33442 "2021-11-10T14:48:49Z")

</div>

Hi, I am still exploring this interesting code, but I met this problem today. I tried to use API to get real-time wind data from a website, but the free plan only allows me to request data 500 times a day. So I was won…

---

## [Drag & Drop PGraphics](https://discourse.processing.org/t/drag-drop-pgraphics/33396)

<div class="topic-metadata">

**Author:** [@rism](https://discourse.processing.org/u/rism)\
**Replies:** 2\
**Last updated:** [November 8, 2021, 2:48pm UTC](https://discourse.processing.org/t/drag-drop-pgraphics/33396 "2021-11-08T14:48:45Z")

</div>

Hi, I am trying to move the square to another position but it forms a streak of squares instead when dragged. Here is what I have so far: PGraphics squares; float bx; float by; boolean locked = false; float xOffset …

---

## [Why are two rects displayed](https://discourse.processing.org/t/why-are-two-rects-displayed/33393)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 1\
**Last updated:** [November 8, 2021, 1:36pm UTC](https://discourse.processing.org/t/why-are-two-rects-displayed/33393 "2021-11-08T13:36:43Z")

</div>

when i press on the kill icon, two rects are displayed when only one should

---

## [Casting 3d to 2d](https://discourse.processing.org/t/casting-3d-to-2d/33185)

<div class="topic-metadata">

**Author:** [@Infi](https://discourse.processing.org/u/Infi)\
**Replies:** 8\
**Last updated:** [November 8, 2021, 12:30pm UTC](https://discourse.processing.org/t/casting-3d-to-2d/33185 "2021-11-08T12:30:20Z")

</div>

Hello, I am searching for a method of casting a loaded 3d object into 2d image, similarly to 2D Topographical Map - #2 by solub Although i would need, instead of height contours, a full 2d image, where gray-scale repre…

---

## [Can I rotate PGraphics by its center axis?](https://discourse.processing.org/t/can-i-rotate-pgraphics-by-its-center-axis/33398)

<div class="topic-metadata">

**Author:** [@Skycstls](https://discourse.processing.org/u/Skycstls)\
**Replies:** 1\
**Last updated:** [November 8, 2021, 12:16pm UTC](https://discourse.processing.org/t/can-i-rotate-pgraphics-by-its-center-axis/33398 "2021-11-08T12:16:02Z")

</div>

Hello processing forum! I have this little code working, it starts by creating a few PGraphics on an array like this: void shapesCreation(int nShapes) { shapes = new PGraphics\[nShapes\]; for (int i = 0; i \< shapes.l…

---

## [Creating a word carpet by rotating and positioning a word a mulitple times](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153)

<div class="topic-metadata">

**Author:** [@ontherun](https://discourse.processing.org/u/ontherun)\
**Replies:** 7\
**Last updated:** [November 8, 2021, 12:26am UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153 "2021-11-08T00:26:30Z")

</div>

Hi dear community, Im quite new into processing, but seeing more and more the advantages for generative design aspects and experiments. So for an analog project I would try out the digital dummy. As written in the head…

---

## [Ball Moving Along the Screen Similar to the Game Pong](https://discourse.processing.org/t/ball-moving-along-the-screen-similar-to-the-game-pong/33388)

<div class="topic-metadata">

**Author:** [@Chels](https://discourse.processing.org/u/Chels)\
**Replies:** 2\
**Last updated:** [November 7, 2021, 9:36pm UTC](https://discourse.processing.org/t/ball-moving-along-the-screen-similar-to-the-game-pong/33388 "2021-11-07T21:36:59Z")

</div>

I’m fairly new to processing. So I searched up the Coding Train channel on YouTube and changed a bit of a code to not have the bouncing ball get cut out the window when it runs. Source: https://www.youtube.com/watch?v=Y…

---

## [Connecting Perlin noise waves](https://discourse.processing.org/t/connecting-perlin-noise-waves/33359)

<div class="topic-metadata">

**Author:** [@basielcole](https://discourse.processing.org/u/basielcole)\
**Replies:** 2\
**Last updated:** [November 7, 2021, 12:21pm UTC](https://discourse.processing.org/t/connecting-perlin-noise-waves/33359 "2021-11-07T12:21:32Z")

</div>

Hi everyone, I have been trying to connect two or more waves generated with the noise() function. The idea is to get one continuous wave with specific areas having more/less noise added to them. Is there a simple way to …

---

## [Insert a path into a flowfield](https://discourse.processing.org/t/insert-a-path-into-a-flowfield/33334)

<div class="topic-metadata">

**Author:** [@sigbjorn](https://discourse.processing.org/u/sigbjorn)\
**Replies:** 0\
**Last updated:** [November 5, 2021, 1:26pm UTC](https://discourse.processing.org/t/insert-a-path-into-a-flowfield/33334 "2021-11-05T13:26:35Z")

</div>

Hi I have an art project for my class. For this I would like to insert a path function to a flowfield. I feel like im almost done, but cant seem to place the last puzzle. For mye work I have been using the Coding trai…

---

## [How to de-register a running thread in Processing](https://discourse.processing.org/t/how-to-de-register-a-running-thread-in-processing/33337)

<div class="topic-metadata">

**Author:** [@avong](https://discourse.processing.org/u/avong)\
**Replies:** 2\
**Last updated:** [November 6, 2021, 6:11am UTC](https://discourse.processing.org/t/how-to-de-register-a-running-thread-in-processing/33337 "2021-11-06T06:11:12Z")

</div>

Permit me to ask once again. I have read and understand how to register thread using the "thread( " “)” function. but, in all the tutorials, i did not see where i can stop a running thread. is there any helping hand? …

---

## [Erase a rectangle](https://discourse.processing.org/t/erase-a-rectangle/33352)

<div class="topic-metadata">

**Author:** [@stefanmz7](https://discourse.processing.org/u/stefanmz7)\
**Replies:** 8\
**Last updated:** [November 6, 2021, 2:54am UTC](https://discourse.processing.org/t/erase-a-rectangle/33352 "2021-11-06T02:54:54Z")

</div>

Hey so can I erase a shape after drawing it? For example I want to have a circle and a rectangle and when they collide the rectangle is erased,it’s just gone out of the program. So how do I do the erasing? I got the othe…

---

## [Resize rectangle](https://discourse.processing.org/t/resize-rectangle/33343)

<div class="topic-metadata">

**Author:** [@stefanmz7](https://discourse.processing.org/u/stefanmz7)\
**Replies:** 3\
**Last updated:** [November 5, 2021, 6:47pm UTC](https://discourse.processing.org/t/resize-rectangle/33343 "2021-11-05T18:47:24Z")

</div>

Hey,so I need to resize a rectangle when a condition is met. Can I do this? Is there a way to resize a rectangle that is drawn in the draw method() after the fact in an if statement? If something is true then resize the …

---

## [Rendering many objects with a shader](https://discourse.processing.org/t/rendering-many-objects-with-a-shader/33286)

<div class="topic-metadata">

**Author:** [@Brahvim](https://discourse.processing.org/u/Brahvim)\
**Replies:** 2\
**Last updated:** [November 5, 2021, 10:39am UTC](https://discourse.processing.org/t/rendering-many-objects-with-a-shader/33286 "2021-11-05T10:39:28Z")

</div>

Hello there! I made a fragment shader that can render circles, and would like to use it inside Processing as a replacement for Processing’s own functions. An extra question, if it is appropriate to ask this much in one …

---

## [Character Dashing Movement](https://discourse.processing.org/t/character-dashing-movement/33321)

<div class="topic-metadata">

**Author:** [@wending10](https://discourse.processing.org/u/wending10)\
**Replies:** 2\
**Last updated:** [November 5, 2021, 9:19am UTC](https://discourse.processing.org/t/character-dashing-movement/33321 "2021-11-05T09:19:10Z")

</div>

Hi, I would like to ask on how to code on the movement of character. Basically, when I press my right arrow key, it will move right, and when I press my left shift, it will dash for a certain time(using int dashcounter) …

---

## [Use Processing to make continuous graph using CSV](https://discourse.processing.org/t/use-processing-to-make-continuous-graph-using-csv/16898)

<div class="topic-metadata">

**Author:** [@lopklopk](https://discourse.processing.org/u/lopklopk)\
**Replies:** 12\
**Last updated:** [November 4, 2021, 12:49am UTC](https://discourse.processing.org/t/use-processing-to-make-continuous-graph-using-csv/16898 "2021-11-04T00:49:30Z")

</div>

using CSV… In processing to make continuous graph Or Dynamic or animated graph of ECG data :slightly\_smiling\_face: : I’ve using CSV contain one colum for seconds & other for mVolt ECG data AD8232… something like bel…

---

## [Keep background image in P3D](https://discourse.processing.org/t/keep-background-image-in-p3d/33224)

<div class="topic-metadata">

**Author:** [@Kylle](https://discourse.processing.org/u/Kylle)\
**Replies:** 6\
**Last updated:** [November 4, 2021, 8:48am UTC](https://discourse.processing.org/t/keep-background-image-in-p3d/33224 "2021-11-04T08:48:21Z")

</div>

When using the P3D render the loaded 2D image disappears but I will just want to overwrite parts of it with spheres. How to fix this? PImage img; void setup() { size(1500, 800,P3D); img = loadImage("String4.png"); …

---

## [Link or call image when answere correct (Quiz with keyboard input)](https://discourse.processing.org/t/link-or-call-image-when-answere-correct-quiz-with-keyboard-input/33222)

<div class="topic-metadata">

**Author:** [@jelledgwn](https://discourse.processing.org/u/jelledgwn)\
**Replies:** 4\
**Last updated:** [November 3, 2021, 7:53pm UTC](https://discourse.processing.org/t/link-or-call-image-when-answere-correct-quiz-with-keyboard-input/33222 "2021-11-03T19:53:51Z")

</div>

Hello everyone, Im coding a quiz but Im just a beginner. So there is one thing I need help with: What I want: When the answer is correct it needs to go to the next picture. How do I draw the next image when the answ…

---

## [3D image transform question](https://discourse.processing.org/t/3d-image-transform-question/33252)

<div class="topic-metadata">

**Author:** [@zlaccu](https://discourse.processing.org/u/zlaccu)\
**Replies:** 4\
**Last updated:** [November 3, 2021, 2:12pm UTC](https://discourse.processing.org/t/3d-image-transform-question/33252 "2021-11-03T14:12:39Z")

</div>

hi there! im recreating this effect : Login • Instagram but my looks not very good. this is my looks like: I think that in the original video, where the gray value is high, It’s not that the height of boxes change, …

---

## [How to Position Shape based on display size](https://discourse.processing.org/t/how-to-position-shape-based-on-display-size/33238)

<div class="topic-metadata">

**Author:** [@avong](https://discourse.processing.org/u/avong)\
**Replies:** 5\
**Last updated:** [November 3, 2021, 11:12am UTC](https://discourse.processing.org/t/how-to-position-shape-based-on-display-size/33238 "2021-11-03T11:12:59Z")

</div>

I wish to position buttons by calculating the x and y coordinates based on the display size. I did something like this: My laptop screen pixel is 1600x900. \< float x\_button1 =displayWidth-displayWidth/6; float y\_but…

---

## [Merging two sketches (pt.2)](https://discourse.processing.org/t/merging-two-sketches-pt-2/33259)

<div class="topic-metadata">

**Author:** [@acb](https://discourse.processing.org/u/acb)\
**Replies:** 5\
**Last updated:** [November 2, 2021, 9:13pm UTC](https://discourse.processing.org/t/merging-two-sketches-pt-2/33259 "2021-11-02T21:13:35Z")

</div>

As mentioned in my last post, I am trying to merge these codes but I keep getting the error; “java.lang.reflect.InvocationTargetException” . From my research I was not able to understand (I am new to coding), could anyon…

---

## [How to check if "marco" is typed in textbox?](https://discourse.processing.org/t/how-to-check-if-marco-is-typed-in-textbox/33255)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 1\
**Last updated:** [November 2, 2021, 6:16pm UTC](https://discourse.processing.org/t/how-to-check-if-marco-is-typed-in-textbox/33255 "2021-11-02T18:16:08Z")

</div>

how to check if marco is entered in the textbox and increase balance\[0\] by 75 when this happens for the first time static final int NUM = 2; final TextBox\[\] tboxes = new TextBox\[NUM\]; int idx; PImage shop; PImage …

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

[Next page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=40)
