# Processing

**URL:** https://discourse.processing.org/c/processing/6.md?no_subcategories=false&page=160

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

**Page:** 161

---

## [Void function is returning values but shouldn't](https://discourse.processing.org/t/void-function-is-returning-values-but-shouldnt/26528)

<div class="topic-metadata">

**Author:** [@Divitiacus](https://discourse.processing.org/u/Divitiacus)\
**Replies:** 6\
**Last updated:** [December 27, 2020, 1:23pm UTC](https://discourse.processing.org/t/void-function-is-returning-values-but-shouldnt/26528 "2020-12-27T13:23:15Z")

</div>

Hi there, as far as I know, void functions do not return values. However, when I run the code below, the wind vector gets smaller and smaller with each frame, because the va value is returned back as new wind vector. …

---

## [Nth degree pendulum](https://discourse.processing.org/t/nth-degree-pendulum/26411)

<div class="topic-metadata">

**Author:** [@Rafsing](https://discourse.processing.org/u/Rafsing)\
**Replies:** 12\
**Last updated:** [December 27, 2020, 10:24am UTC](https://discourse.processing.org/t/nth-degree-pendulum/26411 "2020-12-27T10:24:48Z")

</div>

I made an nth degree pendulum, but it moves very fast. This means there is something wrong with the equations of motion: for (int i = 1; i \<circles.size(); i++) { circles.get(i).acceleration.set(0, (-g / lenghts…

---

## [How to change images graphically when receiving data?](https://discourse.processing.org/t/how-to-change-images-graphically-when-receiving-data/26523)

<div class="topic-metadata">

**Author:** [@Vadimkuzmin](https://discourse.processing.org/u/Vadimkuzmin)\
**Replies:** 2\
**Last updated:** [December 27, 2020, 4:50am UTC](https://discourse.processing.org/t/how-to-change-images-graphically-when-receiving-data/26523 "2020-12-27T04:50:06Z")

</div>

Good afternoon, I am using a terminal to send data via com-port. I work under the protocol. In the project, the Displaydata tab contains the string “case 35” - the # symbol. What to write between case 35: and break; …

---

## [Generate random not overlapping triangles](https://discourse.processing.org/t/generate-random-not-overlapping-triangles/25875)

<div class="topic-metadata">

**Author:** [@nktlst](https://discourse.processing.org/u/nktlst)\
**Replies:** 9\
**Last updated:** [December 26, 2020, 7:24pm UTC](https://discourse.processing.org/t/generate-random-not-overlapping-triangles/25875 "2020-12-26T19:24:09Z")

</div>

Hi! I trying to understand how this task can be solved: I need generate number of triangles (any size) in any random place on sketch, but i need them not overlapping with each other and may be with constant distance fro…

---

## [Addition of all integer numbers from 1 - 100 (loop)](https://discourse.processing.org/t/addition-of-all-integer-numbers-from-1-100-loop/26237)

<div class="topic-metadata">

**Author:** [@hullah](https://discourse.processing.org/u/hullah)\
**Replies:** 5\
**Last updated:** [December 26, 2020, 1:47am UTC](https://discourse.processing.org/t/addition-of-all-integer-numbers-from-1-100-loop/26237 "2020-12-26T01:47:41Z")

</div>

hey guys, I am an absolutely beginner who wants to add all integer numbers from 1 to 100 ( in a loop) and print the result with println(). I know that I should use a for() loop but how can I add each element of 1-100 in…

---

## [Using String\[ : 10\] in Java mode](https://discourse.processing.org/t/using-string-10-in-java-mode/26520)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 1\
**Last updated:** [December 26, 2020, 1:05pm UTC](https://discourse.processing.org/t/using-string-10-in-java-mode/26520 "2020-12-26T13:05:50Z")

</div>

I started learning processing.py and found a String\[int\] function (String.charAt( ) ) and String\[ : int \] which returns the string before int. Can I do something similar to it in Java mode (normal processing) without us…

---

## [How to create a vector with 4 parameters?](https://discourse.processing.org/t/how-to-create-a-vector-with-4-parameters/26509)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 4\
**Last updated:** [December 25, 2020, 5:19pm UTC](https://discourse.processing.org/t/how-to-create-a-vector-with-4-parameters/26509 "2020-12-25T17:19:36Z")

</div>

How do I create a vector with 4 varriables stored within? (position x & y, speed x & y) so something like //moving the ball ball = new PVector( ball.x + ball.z, ball.y + ball.w, ball.z\*friction, ball.w\*friction); circl…

---

## [Line-Line intersection for y=mx+c](https://discourse.processing.org/t/line-line-intersection-for-y-mx-c/26484)

<div class="topic-metadata">

**Author:** [@dave307](https://discourse.processing.org/u/dave307)\
**Replies:** 4\
**Last updated:** [December 25, 2020, 2:51pm UTC](https://discourse.processing.org/t/line-line-intersection-for-y-mx-c/26484 "2020-12-25T14:51:48Z")

</div>

I was wondering how to make a function that you give it two line equations in the form y=mx+c you pass it the gradient and y-intercept of both. then it returns a vector which is the point in which the two given lines w…

---

## [Live updating counter (need to use strings or array?)](https://discourse.processing.org/t/live-updating-counter-need-to-use-strings-or-array/26472)

<div class="topic-metadata">

**Author:** [@codestruggles](https://discourse.processing.org/u/codestruggles)\
**Replies:** 11\
**Last updated:** [December 25, 2020, 5:50am UTC](https://discourse.processing.org/t/live-updating-counter-need-to-use-strings-or-array/26472 "2020-12-25T05:50:24Z")

</div>

Hello, I’m having some trouble figuring out how to make a simple number counter that is connected to events in airtable. Basically, i have a table which tracks at what time an event occured and i would like to have a c…

---

## [Random mp3 files](https://discourse.processing.org/t/random-mp3-files/26346)

<div class="topic-metadata">

**Author:** [@toc\_toc\_toc](https://discourse.processing.org/u/toc_toc_toc)\
**Replies:** 17\
**Last updated:** [December 24, 2020, 6:34pm UTC](https://discourse.processing.org/t/random-mp3-files/26346 "2020-12-24T18:34:41Z")

</div>

I’m trying to make a random generator of mp3 files on Processing but I don’t know how to do it. I’ve tried to create a class (and before I tried it with an Array) with my audio files but I can’t get it to run. import …

---

## [How to run build .exe sketch from command line?](https://discourse.processing.org/t/how-to-run-build-exe-sketch-from-command-line/26449)

<div class="topic-metadata">

**Author:** [@trackme518](https://discourse.processing.org/u/trackme518)\
**Replies:** 3\
**Last updated:** [December 24, 2020, 2:46pm UTC](https://discourse.processing.org/t/how-to-run-build-exe-sketch-from-command-line/26449 "2020-12-24T14:46:35Z")

</div>

Hi, how can you run build sketch as .exe file from command line? When you build the app in windows you get the folder structure with yoursketch.exe inside. It works just fine when you double click it. But I can not find…

---

## [Sending Live data from Processing to Grasshopper](https://discourse.processing.org/t/sending-live-data-from-processing-to-grasshopper/26473)

<div class="topic-metadata">

**Author:** [@DariaSuzanne](https://discourse.processing.org/u/DariaSuzanne)\
**Replies:** 1\
**Last updated:** [December 24, 2020, 8:33am UTC](https://discourse.processing.org/t/sending-live-data-from-processing-to-grasshopper/26473 "2020-12-24T08:33:39Z")

</div>

Hello I have recently learned that you can send data from processing to various softwares. I was wondering if anyone has any idea about an error I keep encountering: \[2020/12/23 14:0:59\] ERROR @ UdpClient.send ioexcept…

---

## [P3/Windows/NewInstall Sketch Size Problem](https://discourse.processing.org/t/p3-windows-newinstall-sketch-size-problem/13710)

<div class="topic-metadata">

**Author:** [@bmcdeepak](https://discourse.processing.org/u/bmcdeepak)\
**Replies:** 3\
**Last updated:** [December 24, 2020, 7:34am UTC](https://discourse.processing.org/t/p3-windows-newinstall-sketch-size-problem/13710 "2020-12-24T07:34:35Z")

</div>

Greetings! Just installed Processing 3.5.3 on a PC running Windows. No matter which sketch I run, including empty with no commands, the Run option always gives a sketch/display window the size of the entire display (not…

---

## [I am finding an error while cloning the project in my local](https://discourse.processing.org/t/i-am-finding-an-error-while-cloning-the-project-in-my-local/26460)

<div class="topic-metadata">

**Author:** [@Arpi1234](https://discourse.processing.org/u/Arpi1234)\
**Replies:** 3\
**Last updated:** [December 24, 2020, 4:48am UTC](https://discourse.processing.org/t/i-am-finding-an-error-while-cloning-the-project-in-my-local/26460 "2020-12-24T04:48:07Z")

</div>

please format code with \</\> button \* homework policy \* asking questions error: RPC failed; curl 56 OpenSSL SSL\_read: error:1408F119:SSL routines:ssl3\_get\_record:decryption failed or bad record mac, errno 0 fatal: th…

---

## [How to truncate, limit, clamp, constrain, shorten, etc ... a string?](https://discourse.processing.org/t/how-to-truncate-limit-clamp-constrain-shorten-etc-a-string/26458)

<div class="topic-metadata">

**Author:** [@CaseyJ](https://discourse.processing.org/u/CaseyJ)\
**Replies:** 2\
**Last updated:** [December 24, 2020, 4:19am UTC](https://discourse.processing.org/t/how-to-truncate-limit-clamp-constrain-shorten-etc-a-string/26458 "2020-12-24T04:19:52Z")

</div>

I have a better feeling for how to limit the run on numbers in a long decimal using the nf() function in Processing. However, how do you do this with a string? I see no alternative so maybe you can still use nf()? For…

---

## [3D Rotation Question](https://discourse.processing.org/t/3d-rotation-question/26438)

<div class="topic-metadata">

**Author:** [@RFullum](https://discourse.processing.org/u/RFullum)\
**Replies:** 8\
**Last updated:** [December 24, 2020, 12:05am UTC](https://discourse.processing.org/t/3d-rotation-question/26438 "2020-12-24T00:05:15Z")

</div>

Hey all, I used the Flocking example as a starting point, and made a flocking sketch that works in 3D, with multiple flocks being influenced by FFT band amplitudes. The problem i’m running into is getting each boid to r…

---

## [Beginner's problem with while() loop](https://discourse.processing.org/t/beginners-problem-with-while-loop/26469)

<div class="topic-metadata">

**Author:** [@nazazaku](https://discourse.processing.org/u/nazazaku)\
**Replies:** 5\
**Last updated:** [December 23, 2020, 9:29pm UTC](https://discourse.processing.org/t/beginners-problem-with-while-loop/26469 "2020-12-23T21:29:35Z")

</div>

I just want to do a simple grid with circles, but it just doesn’t work. The circles don’t complete the grid and stop at a random point. The circles stop at a different point each time I run the program. Pls help. I’m us…

---

## [Random movement](https://discourse.processing.org/t/random-movement/26464)

<div class="topic-metadata">

**Author:** [@hullah](https://discourse.processing.org/u/hullah)\
**Replies:** 6\
**Last updated:** [December 23, 2020, 4:12pm UTC](https://discourse.processing.org/t/random-movement/26464 "2020-12-23T16:12:56Z")

</div>

hey folks, I would like to code a game in which you see the ocean from top view (so far no problems) . On the ocean there should be a boat (imported png) that changes direction inside the window randomly. Which function…

---

## [A problem with knowing if a window is minimized](https://discourse.processing.org/t/a-problem-with-knowing-if-a-window-is-minimized/26476)

<div class="topic-metadata">

**Author:** [@dacoconutchemist](https://discourse.processing.org/u/dacoconutchemist)\
**Replies:** 0\
**Last updated:** [December 23, 2020, 3:16pm UTC](https://discourse.processing.org/t/a-problem-with-knowing-if-a-window-is-minimized/26476 "2020-12-23T15:16:28Z")

</div>

Hi, I am new to here. I need to know if the main window is minimised. Full problem: I have a multi window G4P project and if the main window is minimized, I want to minimize others(G4P windows), I want them to act as on…

---

## [Dessiner plusieurs polygones et ils doivent formés une art polynomial](https://discourse.processing.org/t/dessiner-plusieurs-polygones-et-ils-doivent-formes-une-art-polynomial/26456)

<div class="topic-metadata">

**Author:** [@nina](https://discourse.processing.org/u/nina)\
**Replies:** 4\
**Last updated:** [December 23, 2020, 1:34pm UTC](https://discourse.processing.org/t/dessiner-plusieurs-polygones-et-ils-doivent-formes-une-art-polynomial/26456 "2020-12-23T13:34:22Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Bonjour, J’ai fait un programme pour qu’il me fasse une translation si le déplacement était égale à vingt . Puis, j’ai utiliser une boucle For …

---

## [How do I export groups of objects in SVG and find them correctly in Inkscape?](https://discourse.processing.org/t/how-do-i-export-groups-of-objects-in-svg-and-find-them-correctly-in-inkscape/16556)

<div class="topic-metadata">

**Author:** [@411x](https://discourse.processing.org/u/411x)\
**Replies:** 8\
**Last updated:** [December 23, 2020, 12:42pm UTC](https://discourse.processing.org/t/how-do-i-export-groups-of-objects-in-svg-and-find-them-correctly-in-inkscape/16556 "2020-12-23T12:42:04Z")

</div>

Hello, I have several shapes and I would like to assign a color to them, so that I can then print them layer by layer. So I would like to assign “objects” to a (color) group that I could then split into layers in inksc…

---

## [Use launch() but have the app minimized?](https://discourse.processing.org/t/use-launch-but-have-the-app-minimized/26452)

<div class="topic-metadata">

**Author:** [@CaseyJ](https://discourse.processing.org/u/CaseyJ)\
**Replies:** 4\
**Last updated:** [December 23, 2020, 12:11am UTC](https://discourse.processing.org/t/use-launch-but-have-the-app-minimized/26452 "2020-12-23T00:11:49Z")

</div>

Is there anyway to use launch() but have the app be minimized when it loads so it doesn’t cover the Processing sketch?

---

## [Default folder when using selectFolder()?](https://discourse.processing.org/t/default-folder-when-using-selectfolder/26289)

<div class="topic-metadata">

**Author:** [@CaseyJ](https://discourse.processing.org/u/CaseyJ)\
**Replies:** 3\
**Last updated:** [December 22, 2020, 7:49pm UTC](https://discourse.processing.org/t/default-folder-when-using-selectfolder/26289 "2020-12-22T19:49:48Z")

</div>

I am new to the selectFolder() game but am loving it! I read in the documentation that there are a few arguments (correct word?) that allow for other options when using this function. I would like to ideally provided a…

---

## [Help, code expecting EOF, found '}'](https://discourse.processing.org/t/help-code-expecting-eof-found/26444)

<div class="topic-metadata">

**Author:** [@Dialias](https://discourse.processing.org/u/Dialias)\
**Replies:** 6\
**Last updated:** [December 22, 2020, 5:41pm UTC](https://discourse.processing.org/t/help-code-expecting-eof-found/26444 "2020-12-22T17:41:23Z")

</div>

int money; PImage pic1; PImage pic2; int rx1 = 250; int ry1 = 200; int rwidth1 = 280; int rheight1 = 140; int rx2 = 600; int ry2 = 600; int rwidth2 = 780; int rheight2 = 780; void setup() { size(800, 600); m…

---

## [Merge 2 codes and improve my work](https://discourse.processing.org/t/merge-2-codes-and-improve-my-work/26437)

<div class="topic-metadata">

**Author:** [@ThibaultLapers](https://discourse.processing.org/u/ThibaultLapers)\
**Replies:** 5\
**Last updated:** [December 22, 2020, 4:45pm UTC](https://discourse.processing.org/t/merge-2-codes-and-improve-my-work/26437 "2020-12-22T16:45:33Z")

</div>

Hello ! This is for a school work. I took someone’s code about dvdvideo meme (on OpenProcessing) and I improved it but really quickly. However, I would like to get help to actually go further in the work to fill the r…

---

## [Setting an Array\[\] as function parameter](https://discourse.processing.org/t/setting-an-array-as-function-parameter/26429)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [December 22, 2020, 12:45pm UTC](https://discourse.processing.org/t/setting-an-array-as-function-parameter/26429 "2020-12-22T12:45:48Z")

</div>

Hi! I made a quiz program where you have to create a String q\[\] = {"what is the first letter?","a","b","c"}; and use this in addQuestion(q,2); is it possible to use something like addQuestion( {"what is the first lette…

---

## [Help with minim](https://discourse.processing.org/t/help-with-minim/6784)

<div class="topic-metadata">

**Author:** [@Dia](https://discourse.processing.org/u/Dia)\
**Replies:** 2\
**Last updated:** [December 22, 2020, 11:45am UTC](https://discourse.processing.org/t/help-with-minim/6784 "2020-12-22T11:45:24Z")

</div>

Hi , so i’m trying to build a synth using minim, i took aside, the “CreateAnInstrument” exemple to build a keyboard, the problem is i would like to make so that when the key to play the note is released, the note stops p…

---

## [Using sin() function](https://discourse.processing.org/t/using-sin-function/26293)

<div class="topic-metadata">

**Author:** [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)\
**Replies:** 5\
**Last updated:** [December 22, 2020, 9:03am UTC](https://discourse.processing.org/t/using-sin-function/26293 "2020-12-22T09:03:19Z")

</div>

Hi, everyone ! I want to ask, when using function sin(), how to control it ? I mean, when sin() reaches to -1 I want to say stop and move after some time. For example, see this sketch . I appreciate any help, thanks ! …

---

## [How to define two types of variables in a for-loop](https://discourse.processing.org/t/how-to-define-two-types-of-variables-in-a-for-loop/26414)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 7\
**Last updated:** [December 22, 2020, 8:47am UTC](https://discourse.processing.org/t/how-to-define-two-types-of-variables-in-a-for-loop/26414 "2020-12-22T08:47:18Z")

</div>

Hi! Today I leared something like this size(600, 600); for (int i = 0, mi = 10, r = 200; i \< mi; i++) line(cos(TWO\_PI/mi\*i)\*r+width/2, sin(TWO\_PI/mi\*i)\*r+height/2, cos(TWO\_PI/mi\*(i+1))\*r+width/2, sin(TWO\_PI/mi\*(i+1))\*r…

---

## [Write code smarter and better](https://discourse.processing.org/t/write-code-smarter-and-better/26213)

<div class="topic-metadata">

**Author:** [@vestergaard12](https://discourse.processing.org/u/vestergaard12)\
**Replies:** 15\
**Last updated:** [December 22, 2020, 7:33am UTC](https://discourse.processing.org/t/write-code-smarter-and-better/26213 "2020-12-22T07:33:53Z")

</div>

Hello Processing Foundation How would you compromize this code, for example into a for-loop or one simple function? if (key == c\[n\]) { n++; text1\[0\] = text1\[0\].substring(0, n-1) + '-' + text1\[0\].substri…

[Previous page](https://discourse.processing.org/c/processing/6.md?no_subcategories=false&page=159)

[Next page](https://discourse.processing.org/c/processing/6.md?no_subcategories=false&page=161)
