# Coding Questions

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

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

**Page:** 126

---

## [Making a loop infinite](https://discourse.processing.org/t/making-a-loop-infinite/14373)

<div class="topic-metadata">

**Author:** [@Adrian1998](https://discourse.processing.org/u/Adrian1998)\
**Replies:** 1\
**Last updated:** [October 2, 2019, 5:10pm UTC](https://discourse.processing.org/t/making-a-loop-infinite/14373 "2019-10-02T17:10:17Z")

</div>

Hello, so I need help with finding a way to make the black striped lines infinte, currently it starts at -100, but the lines stops printing after a little. Also im having trouble with the yellow solid line, currently the…

---

## [Using millis() to count](https://discourse.processing.org/t/using-millis-to-count/3093)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 16\
**Last updated:** [October 2, 2019, 12:51pm UTC](https://discourse.processing.org/t/using-millis-to-count/3093 "2019-10-02T12:51:15Z")

</div>

I’ve been trying to find a way to solve this problem for a while. I remember seeing a solution somewhere on the internet a while back but I can’t find it now. I was hoping to be able to use a modulo condition to check f…

---

## [Height / width for a beginner](https://discourse.processing.org/t/height-width-for-a-beginner/14364)

<div class="topic-metadata">

**Author:** [@harsande](https://discourse.processing.org/u/harsande)\
**Replies:** 3\
**Last updated:** [October 2, 2019, 10:47am UTC](https://discourse.processing.org/t/height-width-for-a-beginner/14364 "2019-10-02T10:47:35Z")

</div>

Hi, I’m all new to Processing, trying to learn the basics. Right now I’m trying to make a square expand for the center of a window. This works fine except for the first time running the loop. I am defining corner x and …

---

## [Can a function like this load images?](https://discourse.processing.org/t/can-a-function-like-this-load-images/14354)

<div class="topic-metadata">

**Author:** [@ImDaGr3en](https://discourse.processing.org/u/ImDaGr3en)\
**Replies:** 2\
**Last updated:** [October 2, 2019, 10:05am UTC](https://discourse.processing.org/t/can-a-function-like-this-load-images/14354 "2019-10-02T10:05:52Z")

</div>

I wrote a function assuming that I could pass to an array of images, an array of strings and the length of the two of them and it would have loaded the images, stored into the strings, in the elements of the images array…

---

## [Java reflect Field get class variables](https://discourse.processing.org/t/java-reflect-field-get-class-variables/14357)

<div class="topic-metadata">

**Author:** [@GeorgeJava](https://discourse.processing.org/u/GeorgeJava)\
**Replies:** 3\
**Last updated:** [October 2, 2019, 7:56am UTC](https://discourse.processing.org/t/java-reflect-field-get-class-variables/14357 "2019-10-02T07:56:38Z")

</div>

Hello, i want to load all variables from sketch and want to check some variables in the specific class and do some changes, how i can get class from Field ? :neutral\_face::thinking: import java.lang.reflect.Field; test…

---

## [Random Circles in circles](https://discourse.processing.org/t/random-circles-in-circles/14360)

<div class="topic-metadata">

**Author:** [@Epic\_ModZz](https://discourse.processing.org/u/Epic_ModZz)\
**Replies:** 9\
**Last updated:** [October 2, 2019, 2:17am UTC](https://discourse.processing.org/t/random-circles-in-circles/14360 "2019-10-02T02:17:17Z")

</div>

I would like to generate circles at a random place in a circle, I do not know how to do this without having the circles generated by the generator overlap the edges of the starting circle please send code

---

## [Detecting object collision](https://discourse.processing.org/t/detecting-object-collision/14336)

<div class="topic-metadata">

**Author:** [@quoi](https://discourse.processing.org/u/quoi)\
**Replies:** 1\
**Last updated:** [October 1, 2019, 11:58am UTC](https://discourse.processing.org/t/detecting-object-collision/14336 "2019-10-01T11:58:27Z")

</div>

Hello! I’m new to processing, and i’m wondering how can i compare two variables from different classes with each other. Can someone please guide me in the right direction… if you are wondering here is my code: float an…

---

## [I don't understand why this doesn't work](https://discourse.processing.org/t/i-dont-understand-why-this-doesnt-work/14327)

<div class="topic-metadata">

**Author:** [@ImDaGr3en](https://discourse.processing.org/u/ImDaGr3en)\
**Replies:** 3\
**Last updated:** [September 30, 2019, 10:00pm UTC](https://discourse.processing.org/t/i-dont-understand-why-this-doesnt-work/14327 "2019-09-30T22:00:09Z")

</div>

I’m trying to make some functions that allow me to show some images in the window, so I made a class in which I put the PImage variables and a function that allows me to load the images, but it doesn’t actually work. (An…

---

## [indexOf with nested ArrayList](https://discourse.processing.org/t/indexof-with-nested-arraylist/14272)

<div class="topic-metadata">

**Author:** [@companje](https://discourse.processing.org/u/companje)\
**Replies:** 4\
**Last updated:** [September 30, 2019, 8:22pm UTC](https://discourse.processing.org/t/indexof-with-nested-arraylist/14272 "2019-09-30T20:22:21Z")

</div>

Hi there, I’ve got some menu structure where I’m nesting ArrayLists like this class Menu extends ArrayList\<Menu\>. It gives me some really interesting results when I’m using indexOf. Somehow it looks like it’s doing a re…

---

## [Trouble with bouncing ball](https://discourse.processing.org/t/trouble-with-bouncing-ball/14312)

<div class="topic-metadata">

**Author:** [@abigail](https://discourse.processing.org/u/abigail)\
**Replies:** 6\
**Last updated:** [September 30, 2019, 2:08pm UTC](https://discourse.processing.org/t/trouble-with-bouncing-ball/14312 "2019-09-30T14:08:17Z")

</div>

Hi, so far I just have a ball bouncing on the screen, but the sketch stops working when I add the number 125 into the - if (y \<= 125), part of my code, although it works when I have 100 instead of 125. Can anyone explai…

---

## [3D view in processing](https://discourse.processing.org/t/3d-view-in-processing/14292)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.processing.org/u/alice)\
**Replies:** 3\
**Last updated:** [September 30, 2019, 12:06pm UTC](https://discourse.processing.org/t/3d-view-in-processing/14292 "2019-09-30T12:06:18Z")

</div>

Hello, I have a question regarding the 3D view in processing : I’m trying to have a 3D view of the following code but looks like doesn’t work … I’m trying to have that black background as in the image Cell\[\]\[\] grid;…

---

## [Fill with points with noise stroke without killing FPS](https://discourse.processing.org/t/fill-with-points-with-noise-stroke-without-killing-fps/14286)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 4\
**Last updated:** [September 30, 2019, 10:59am UTC](https://discourse.processing.org/t/fill-with-points-with-noise-stroke-without-killing-fps/14286 "2019-09-30T10:59:39Z")

</div>

Is there a way to do this without having the frame rate go down to about 8fps? Use noise to set the stroke color of a dot between 0-255, uniformly fill an area with dots. Like TV snow. float noiseScale = 0.02; float r;…

---

## [Only using line commands](https://discourse.processing.org/t/only-using-line-commands/14294)

<div class="topic-metadata">

**Author:** [@elcougario](https://discourse.processing.org/u/elcougario)\
**Replies:** 1\
**Last updated:** [September 30, 2019, 3:51am UTC](https://discourse.processing.org/t/only-using-line-commands/14294 "2019-09-30T03:51:54Z")

</div>

Hey guys! I’m new to this whole processing thing. I have a project for a class and we can only use the line command. I’m trying to duplicate what i’ve done on the left side of my window to the right to make it look kin…

---

## [Small help with a small draw](https://discourse.processing.org/t/small-help-with-a-small-draw/14300)

<div class="topic-metadata">

**Author:** [@pokedav](https://discourse.processing.org/u/pokedav)\
**Replies:** 1\
**Last updated:** [September 30, 2019, 3:41am UTC](https://discourse.processing.org/t/small-help-with-a-small-draw/14300 "2019-09-30T03:41:10Z")

</div>

Hi guys, I just want to draw somethin, clear the screen and draw another thing, and put that in a loop, here´s the code: void setup() { fullScreen(); frameRate(1); background(190); } void draw() { int j=0; f…

---

## [Accurate event Timer?](https://discourse.processing.org/t/accurate-event-timer/14260)

<div class="topic-metadata">

**Author:** [@edward](https://discourse.processing.org/u/edward)\
**Replies:** 3\
**Last updated:** [September 30, 2019, 2:01am UTC](https://discourse.processing.org/t/accurate-event-timer/14260 "2019-09-30T02:01:26Z")

</div>

Hi guys, I’d be grateful for your guidance. I would like to have a Timer that triggers an event every 20ms. with good accuracy. Every 20ms it will read a value from an arrayList and it will send it through Serial. I hav…

---

## [Could not run the sketch.( Target VM failed to initialize)](https://discourse.processing.org/t/could-not-run-the-sketch-target-vm-failed-to-initialize/14280)

<div class="topic-metadata">

**Author:** [@yangms3302](https://discourse.processing.org/u/yangms3302)\
**Replies:** 1\
**Last updated:** [September 29, 2019, 2:30pm UTC](https://discourse.processing.org/t/could-not-run-the-sketch-target-vm-failed-to-initialize/14280 "2019-09-29T14:30:13Z")

</div>

Hi. I am getting this error message every time I run a code. I put jpg file in the sketch file folder in ‘data’ folder, and already tried several times. Here is a code: PImage img; void setup() { size(640, 360); fram…

---

## [Referencing a class using a string stored in another class?](https://discourse.processing.org/t/referencing-a-class-using-a-string-stored-in-another-class/14268)

<div class="topic-metadata">

**Author:** [@Inertia\_Squared](https://discourse.processing.org/u/Inertia_Squared)\
**Replies:** 1\
**Last updated:** [September 29, 2019, 11:02am UTC](https://discourse.processing.org/t/referencing-a-class-using-a-string-stored-in-another-class/14268 "2019-09-29T11:02:49Z")

</div>

I’m having trouble getting a class to reference a variable from another class using a string, it gives me the error ‘that the global variable “variableName” does not exist.’ How could I get this to work? For an example …

---

## [Join vertices of PShapes after translation / rotation](https://discourse.processing.org/t/join-vertices-of-pshapes-after-translation-rotation/14246)

<div class="topic-metadata">

**Author:** [@BennyHacker](https://discourse.processing.org/u/BennyHacker)\
**Replies:** 2\
**Last updated:** [September 28, 2019, 7:47pm UTC](https://discourse.processing.org/t/join-vertices-of-pshapes-after-translation-rotation/14246 "2019-09-28T19:47:52Z")

</div>

Hello Forum. I’m trying to join the top and bottom of two cubes which are being rotated in 3D space. I can’t seem to reliably update the vertices of these shapes after they are being rotated. I’ve tried simply joining…

---

## [Animating Sketch 101](https://discourse.processing.org/t/animating-sketch-101/14254)

<div class="topic-metadata">

**Author:** [@las6525](https://discourse.processing.org/u/las6525)\
**Replies:** 2\
**Last updated:** [September 28, 2019, 7:47am UTC](https://discourse.processing.org/t/animating-sketch-101/14254 "2019-09-28T07:47:49Z")

</div>

Hi All, Below is my first sketch, I am aiming to animated it (besides bouncing around the window). I am in some serious need of pointers of how I should set up my code to have a shape appear and disappear with the mouse…

---

## [Quicksort visualization](https://discourse.processing.org/t/quicksort-visualization/14120)

<div class="topic-metadata">

**Author:** [@hawko](https://discourse.processing.org/u/hawko)\
**Replies:** 9\
**Last updated:** [September 28, 2019, 1:37pm UTC](https://discourse.processing.org/t/quicksort-visualization/14120 "2019-09-28T13:37:59Z")

</div>

I’m trying to write a quicksort visualization, but the sorting happens too fast. float\[\] values; void swap(float\[\] arr, int a, int b) { float temp = arr\[a\]; arr\[a\] = arr\[b\]; arr\[b\] = temp; // delay(1); red…

---

## [How to do a lowpass signal filtering in Processing?](https://discourse.processing.org/t/how-to-do-a-lowpass-signal-filtering-in-processing/14251)

<div class="topic-metadata">

**Author:** [@KGS](https://discourse.processing.org/u/KGS)\
**Replies:** 1\
**Last updated:** [September 28, 2019, 3:41am UTC](https://discourse.processing.org/t/how-to-do-a-lowpass-signal-filtering-in-processing/14251 "2019-09-28T03:41:36Z")

</div>

I have data for pulse recording. Since it’s embedded with noise I need to filter the signal real TIme so I can visualize the pulse pattern. How can I do it with Processing software?

---

## [Orbiting issues](https://discourse.processing.org/t/orbiting-issues/14244)

<div class="topic-metadata">

**Author:** [@Epic\_ModZz](https://discourse.processing.org/u/Epic_ModZz)\
**Replies:** 3\
**Last updated:** [September 27, 2019, 10:34pm UTC](https://discourse.processing.org/t/orbiting-issues/14244 "2019-09-27T22:34:39Z")

</div>

I am trying to make a circle orbit the larger circle in this cord. My attempts have been failing. Please help ArrayList Balls; int mass; byte h; PFont font; int x = mass; void setup(){ size(640, 640); frameRate(60…

---

## [Image Loading: Processing 2 vs 3](https://discourse.processing.org/t/image-loading-processing-2-vs-3/14194)

<div class="topic-metadata">

**Author:** [@mnoble](https://discourse.processing.org/u/mnoble)\
**Replies:** 8\
**Last updated:** [September 27, 2019, 5:07pm UTC](https://discourse.processing.org/t/image-loading-processing-2-vs-3/14194 "2019-09-27T17:07:02Z")

</div>

Hello, My students are making interactive collages and importing a lot of .pngs. We noticed that Processing 3 is really laggy for simple image animations that run fine of Processing 2. Does anyone know why this is and h…

---

## [I need help with optimization of a basic sharpening algorithm](https://discourse.processing.org/t/i-need-help-with-optimization-of-a-basic-sharpening-algorithm/14192)

<div class="topic-metadata">

**Author:** [@F53](https://discourse.processing.org/u/F53)\
**Replies:** 4\
**Last updated:** [September 26, 2019, 2:50pm UTC](https://discourse.processing.org/t/i-need-help-with-optimization-of-a-basic-sharpening-algorithm/14192 "2019-09-26T14:50:59Z")

</div>

Hi, one of my recent projects led me into making a sharpening filter, but I am having problems making it run smoothly. The code is modified from the (also very slow) sharpening code found in this processing tutorial on …

---

## [How to create Parabola?](https://discourse.processing.org/t/how-to-create-parabola/14213)

<div class="topic-metadata">

**Author:** [@OBadstue](https://discourse.processing.org/u/OBadstue)\
**Replies:** 2\
**Last updated:** [September 26, 2019, 1:02pm UTC](https://discourse.processing.org/t/how-to-create-parabola/14213 "2019-09-26T13:02:07Z")

</div>

So I’m doing a project for school (only been using processing for a week or two), and I’ve been tasked with creating a program that can draw Bézier curves (which i kinda sorted out), and parabolas (preferably on top of e…

---

## [Overlapping braid pattern with cos waves](https://discourse.processing.org/t/overlapping-braid-pattern-with-cos-waves/14107)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 4\
**Last updated:** [September 25, 2019, 10:31pm UTC](https://discourse.processing.org/t/overlapping-braid-pattern-with-cos-waves/14107 "2019-09-25T22:31:29Z")

</div>

float amp; float time; //Number of Strands int nos; //Phase difference b/w strands float phase; float\[\]\[\] x; void setup() { size(1000, 900); background(0); amp=70; nos=3; phase=TWO\_PI/nos; x=new float\[nos…

---

## [P3D renders edges blurryly](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151)

<div class="topic-metadata">

**Author:** [@F53](https://discourse.processing.org/u/F53)\
**Replies:** 13\
**Last updated:** [September 25, 2019, 9:32pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151 "2019-09-25T21:32:05Z")

</div>

P2D and the default renderer give me the same crisp not blurry results as each other. But both suffer severe frame loss when pipes are displayed on screen. P3D, (which I was at the time calling as fullscreen(OPENGL)) ne…

---

## [Why does my for loop create cells in one specific area instead of in a grid?](https://discourse.processing.org/t/why-does-my-for-loop-create-cells-in-one-specific-area-instead-of-in-a-grid/14197)

<div class="topic-metadata">

**Author:** [@Haggisllama](https://discourse.processing.org/u/Haggisllama)\
**Replies:** 1\
**Last updated:** [September 25, 2019, 8:33am UTC](https://discourse.processing.org/t/why-does-my-for-loop-create-cells-in-one-specific-area-instead-of-in-a-grid/14197 "2019-09-25T08:33:53Z")

</div>

alright I made this code to try and get a grid of cells across the screen to try and make a cellular automata as I am quite new to programming but when I run this all of my cells are in one place near the bottom center o…

---

## [Size Command Not Following](https://discourse.processing.org/t/size-command-not-following/14185)

<div class="topic-metadata">

**Author:** [@DM\_Slippin](https://discourse.processing.org/u/DM_Slippin)\
**Replies:** 1\
**Last updated:** [September 24, 2019, 11:15pm UTC](https://discourse.processing.org/t/size-command-not-following/14185 "2019-09-24T23:15:57Z")

</div>

My code will not adjust when I change my size command, such that my variables do not pick up on what command size I have requested, why is that? void setup() { size(500,500); //Canvas Size } // The following are all th…

---

## [SVG output does not match Sketch visual?](https://discourse.processing.org/t/svg-output-does-not-match-sketch-visual/14168)

<div class="topic-metadata">

**Author:** [@Marinus](https://discourse.processing.org/u/Marinus)\
**Replies:** 9\
**Last updated:** [September 24, 2019, 11:04pm UTC](https://discourse.processing.org/t/svg-output-does-not-match-sketch-visual/14168 "2019-09-24T23:04:55Z")

</div>

Hi, so I’m working on a generator that creates generated art output to be printed with a DIY pen plotter. I successfully export my generated artwork through SVG output but somehow the SVG looks all garbled up while in m…

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

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