# Processing

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

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

**Page:** 77

---

## [Creating a Processing Library from JavaScript code](https://discourse.processing.org/t/creating-a-processing-library-from-javascript-code/37508)

<div class="topic-metadata">

**Author:** [@Grumpy\_Mike](https://discourse.processing.org/u/Grumpy_Mike)\
**Replies:** 3\
**Last updated:** [June 15, 2022, 7:47pm UTC](https://discourse.processing.org/t/creating-a-processing-library-from-javascript-code/37508 "2022-06-15T19:47:30Z")

</div>

A recent kick starter project was for some Bluetooth connected dice. GoDice The makers then posted an API in the form of a JavaScript example. GoDice JavaScript API Anyone know how this can be made to run in Processi…

---

## [In shooting game, How can I add gravity?](https://discourse.processing.org/t/in-shooting-game-how-can-i-add-gravity/37552)

<div class="topic-metadata">

**Author:** [@Pleasegod](https://discourse.processing.org/u/Pleasegod)\
**Replies:** 2\
**Last updated:** [June 15, 2022, 11:08am UTC](https://discourse.processing.org/t/in-shooting-game-how-can-i-add-gravity/37552 "2022-06-15T11:08:23Z")

</div>

Hello, I’m korean student. In shooting game, How Can I add gravity When falling start and when shape die and respawn, how does it restart gravity from 0 to end. I’m not good at English and please when you answer my que…

---

## [I dont understand why my objects are out of sync?](https://discourse.processing.org/t/i-dont-understand-why-my-objects-are-out-of-sync/37499)

<div class="topic-metadata">

**Author:** [@SpaceWave](https://discourse.processing.org/u/SpaceWave)\
**Replies:** 3\
**Last updated:** [June 15, 2022, 8:52am UTC](https://discourse.processing.org/t/i-dont-understand-why-my-objects-are-out-of-sync/37499 "2022-06-15T08:52:58Z")

</div>

Excuse my formatting as this is my first forum post, thank you in advance. I have written some code to generate balls that form a circle around (0,0), and then move a set distance away from (0,0) before reversing their …

---

## [Problem with JUnit in a Processing Library](https://discourse.processing.org/t/problem-with-junit-in-a-processing-library/37232)

<div class="topic-metadata">

**Author:** [@AlexRivas](https://discourse.processing.org/u/AlexRivas)\
**Replies:** 2\
**Last updated:** [June 14, 2022, 6:26pm UTC](https://discourse.processing.org/t/problem-with-junit-in-a-processing-library/37232 "2022-06-14T18:26:58Z")

</div>

Hello, im making a processing library in java that makes possible to create presentation without limitations. I’m having a lot of problems, first of all i dont know how could i add JUnit to the properties.xml, furthermo…

---

## [Requirements for modes](https://discourse.processing.org/t/requirements-for-modes/37542)

<div class="topic-metadata">

**Author:** [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Replies:** 4\
**Last updated:** [June 14, 2022, 4:49pm UTC](https://discourse.processing.org/t/requirements-for-modes/37542 "2022-06-14T16:49:16Z")

</div>

I’m currently trying to develop a custom mode for processing. However I don’t know what custom modes need to provide in terms of code to work. What classes/methods do I need to provide to get a custom mode to work?

---

## [I need help with arrays](https://discourse.processing.org/t/i-need-help-with-arrays/37381)

<div class="topic-metadata">

**Author:** [@JosepAlqueza](https://discourse.processing.org/u/JosepAlqueza)\
**Replies:** 15\
**Last updated:** [June 14, 2022, 11:46am UTC](https://discourse.processing.org/t/i-need-help-with-arrays/37381 "2022-06-14T11:46:11Z")

</div>

Hello to all! The program will have to calculate the Santiago de Compostela distance (x, y position 490,110) to all cities and save the coordinates and distance from the city further away in the Array distances. Likewis…

---

## [Nesting "Else If"](https://discourse.processing.org/t/nesting-else-if/37521)

<div class="topic-metadata">

**Author:** [@panko](https://discourse.processing.org/u/panko)\
**Replies:** 6\
**Last updated:** [June 14, 2022, 7:18am UTC](https://discourse.processing.org/t/nesting-else-if/37521 "2022-06-14T07:18:05Z")

</div>

Hi there - I’d like to have a variable number of “else if” statements. I wrote the following code, but it gets a bunch of errors (which I copied and pasted below the code. Does anyone know how to do this? Thanks! void…

---

## [Help with arrays!](https://discourse.processing.org/t/help-with-arrays/37329)

<div class="topic-metadata">

**Author:** [@JosepAlqueza](https://discourse.processing.org/u/JosepAlqueza)\
**Replies:** 9\
**Last updated:** [June 8, 2022, 1:38am UTC](https://discourse.processing.org/t/help-with-arrays/37329 "2022-06-08T01:38:08Z")

</div>

Hello to all! I have an array (Cities) where the first column is the X position and the second column is the Y position. Combined they represent the position on a map of a city. The third can be ignored. I need these v…

---

## [Have two questions, one about arrays and one about integers](https://discourse.processing.org/t/have-two-questions-one-about-arrays-and-one-about-integers/37500)

<div class="topic-metadata">

**Author:** [@Mikey83](https://discourse.processing.org/u/Mikey83)\
**Replies:** 9\
**Last updated:** [June 13, 2022, 12:40am UTC](https://discourse.processing.org/t/have-two-questions-one-about-arrays-and-one-about-integers/37500 "2022-06-13T00:40:10Z")

</div>

Hi, im just wondering if there is a quick solution to fill an array, similar to range in python, i usually use a for loop but is there a shorter way? Also, i know the largest possible integer is 2,147,483,647 and long a…

---

## [Can you start a sketch with Arduino button?](https://discourse.processing.org/t/can-you-start-a-sketch-with-arduino-button/37494)

<div class="topic-metadata">

**Author:** [@friedadedoncker](https://discourse.processing.org/u/friedadedoncker)\
**Replies:** 11\
**Last updated:** [June 13, 2022, 12:15am UTC](https://discourse.processing.org/t/can-you-start-a-sketch-with-arduino-button/37494 "2022-06-13T00:15:48Z")

</div>

Hi! I recently purchased this keyswitch. I was wondering if there’s any way to run a sketch (with this switch). What code would I need for this? Something like: if … == 0 once, run file? Thanks!

---

## [Launch() function does not work](https://discourse.processing.org/t/launch-function-does-not-work/37459)

<div class="topic-metadata">

**Author:** [@Logenli](https://discourse.processing.org/u/Logenli)\
**Replies:** 6\
**Last updated:** [June 13, 2022, 12:09am UTC](https://discourse.processing.org/t/launch-function-does-not-work/37459 "2022-06-13T00:09:49Z")

</div>

Objective: I want to activate/run another processing script using controlp5 button. When users click the button, they can trigger the target script. What I have so far: Here is my code: import controlP5.\*; void setu…

---

## [Can I use map () in a loop?](https://discourse.processing.org/t/can-i-use-map-in-a-loop/37511)

<div class="topic-metadata">

**Author:** [@mvb](https://discourse.processing.org/u/mvb)\
**Replies:** 1\
**Last updated:** [June 12, 2022, 11:26pm UTC](https://discourse.processing.org/t/can-i-use-map-in-a-loop/37511 "2022-06-12T23:26:37Z")

</div>

I have a piece of code and I want to use the map() in order to have the last column of the array with values between 5 and 60. 5 will equal to the minimum value and 60 to the maximum, and the numbers in the middle they w…

---

## [How to find a max value with loop](https://discourse.processing.org/t/how-to-find-a-max-value-with-loop/37476)

<div class="topic-metadata">

**Author:** [@mvb](https://discourse.processing.org/u/mvb)\
**Replies:** 12\
**Last updated:** [June 12, 2022, 8:25pm UTC](https://discourse.processing.org/t/how-to-find-a-max-value-with-loop/37476 "2022-06-12T20:25:16Z")

</div>

How do I find the maximum and minimum value of an array with loops?

---

## [Need help on making scene interactive for semester project](https://discourse.processing.org/t/need-help-on-making-scene-interactive-for-semester-project/37461)

<div class="topic-metadata">

**Author:** [@mahnc1](https://discourse.processing.org/u/mahnc1)\
**Replies:** 4\
**Last updated:** [June 12, 2022, 12:52pm UTC](https://discourse.processing.org/t/need-help-on-making-scene-interactive-for-semester-project/37461 "2022-06-12T12:52:48Z")

</div>

Hi, I have recently been writing a paper on how code can be used to solve modern design problems and really want to show off how interactive coding can be. I am extremely interested yet sadly lack the knowledge and exp…

---

## [Program works on Processing editor but not webpage](https://discourse.processing.org/t/program-works-on-processing-editor-but-not-webpage/37412)

<div class="topic-metadata">

**Author:** [@zellwd](https://discourse.processing.org/u/zellwd)\
**Replies:** 1\
**Last updated:** [June 12, 2022, 3:49am UTC](https://discourse.processing.org/t/program-works-on-processing-editor-but-not-webpage/37412 "2022-06-12T03:49:33Z")

</div>

Hi there, I have this .pde program that works perfectly on the Processing software, but when I add it to a webpage it just appears as a black canvas. I already tried converting it to p5.js but it’s just way too complica…

---

## [What value is missing in my JSON parse?](https://discourse.processing.org/t/what-value-is-missing-in-my-json-parse/37483)

<div class="topic-metadata">

**Author:** [@gis667](https://discourse.processing.org/u/gis667)\
**Replies:** 1\
**Last updated:** [June 12, 2022, 1:28am UTC](https://discourse.processing.org/t/what-value-is-missing-in-my-json-parse/37483 "2022-06-12T01:28:18Z")

</div>

I’m working on building two programs, one in Python and one in Processing, to communicate over socket TCP / data stream. 75% is working perfectly: Encoding JSON and sending over socket from Processing Receiving messag…

---

## [Thoughts on my GUI library for using swing](https://discourse.processing.org/t/thoughts-on-my-gui-library-for-using-swing/37268)

<div class="topic-metadata">

**Author:** [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Replies:** 3\
**Last updated:** [June 11, 2022, 4:23pm UTC](https://discourse.processing.org/t/thoughts-on-my-gui-library-for-using-swing/37268 "2022-06-11T16:23:50Z")

</div>

My first library (Swing Helper) is available on the contributions manager now! It is supposed to help with using swing components in processing. Since this is the first time for me to publish a library I don’t know how …

---

## [What parts of the transform get reset in the draw loop? Does the matrix stack get reset?](https://discourse.processing.org/t/what-parts-of-the-transform-get-reset-in-the-draw-loop-does-the-matrix-stack-get-reset/37454)

<div class="topic-metadata">

**Author:** [@LordXerus](https://discourse.processing.org/u/LordXerus)\
**Replies:** 5\
**Last updated:** [June 10, 2022, 10:32pm UTC](https://discourse.processing.org/t/what-parts-of-the-transform-get-reset-in-the-draw-loop-does-the-matrix-stack-get-reset/37454 "2022-06-10T22:32:58Z")

</div>

Asking because this wasn’t clear in the reference. I thought that the entire matrix stack was discarded, but I ran into the cannot push more than 32 time error. Are the translate, rotate, and scale the only things that a…

---

## [Combined arrays position text](https://discourse.processing.org/t/combined-arrays-position-text/37452)

<div class="topic-metadata">

**Author:** [@mvb](https://discourse.processing.org/u/mvb)\
**Replies:** 2\
**Last updated:** [June 10, 2022, 4:24pm UTC](https://discourse.processing.org/t/combined-arrays-position-text/37452 "2022-06-10T16:24:07Z")

</div>

I have a loaded image of a country and an int array with the coordinates and population of each city, and another string array with the names of the cities. I want to combine them and have the names of the cities appea…

---

## [How does Processing Export work?](https://discourse.processing.org/t/how-does-processing-export-work/36816)

<div class="topic-metadata">

**Author:** [@LordXerus](https://discourse.processing.org/u/LordXerus)\
**Replies:** 6\
**Last updated:** [June 10, 2022, 3:17pm UTC](https://discourse.processing.org/t/how-does-processing-export-work/36816 "2022-06-10T15:17:29Z")

</div>

What exactly does the Processing’s Export Application do? I’m working on a project that uses Processing in IntelliJ, and I managed to get it building as a jar file. How do I turn it into a exe?

---

## [Please, help me, really easy question](https://discourse.processing.org/t/please-help-me-really-easy-question/37433)

<div class="topic-metadata">

**Author:** [@Carlos138](https://discourse.processing.org/u/Carlos138)\
**Replies:** 2\
**Last updated:** [June 9, 2022, 8:49pm UTC](https://discourse.processing.org/t/please-help-me-really-easy-question/37433 "2022-06-09T20:49:19Z")

</div>

With this easy code: void setup () { size(500, 500); background(255, 255, 255); } void draw() { if(keyPressed){ if(key=='a'){ rect(20, 20, 50, 50); } } } Why the square didn’t disappear when I stop clic…

---

## [Translate indefinitely in a for loop](https://discourse.processing.org/t/translate-indefinitely-in-a-for-loop/37373)

<div class="topic-metadata">

**Author:** [@yves](https://discourse.processing.org/u/yves)\
**Replies:** 10\
**Last updated:** [June 9, 2022, 3:30pm UTC](https://discourse.processing.org/t/translate-indefinitely-in-a-for-loop/37373 "2022-06-09T15:30:52Z")

</div>

Hi everyone, I try to translate indefinitely a loop of rectangles, but it doesn’t work properly my code : pushMatrix() ; pushStyle(); fill(255); for (float i=0; i \< width; i = i + 100) { for (int x = 0…

---

## [Disable scaling](https://discourse.processing.org/t/disable-scaling/37417)

<div class="topic-metadata">

**Author:** [@luckorloss](https://discourse.processing.org/u/luckorloss)\
**Replies:** 2\
**Last updated:** [June 9, 2022, 10:47am UTC](https://discourse.processing.org/t/disable-scaling/37417 "2022-06-09T10:47:59Z")

</div>

I use 200% scaling on my desktop to be able to read, but it causes the output window to be twice as large. Everything looks super aliased too. Is there a way to disable scaling on the display window?

---

## [Sketch doesn't scale right with size() function](https://discourse.processing.org/t/sketch-doesnt-scale-right-with-size-function/37396)

<div class="topic-metadata">

**Author:** [@karo](https://discourse.processing.org/u/karo)\
**Replies:** 8\
**Last updated:** [June 9, 2022, 10:46am UTC](https://discourse.processing.org/t/sketch-doesnt-scale-right-with-size-function/37396 "2022-06-09T10:46:50Z")

</div>

Hey there, lately i got an new surface 8pro, and i directly wanted to start coding on it as well as on my desktop work station. But there is a problem, because the sketch on the new laptop does not run with the correc…

---

## [Simple Iterative List](https://discourse.processing.org/t/simple-iterative-list/37398)

<div class="topic-metadata">

**Author:** [@panko](https://discourse.processing.org/u/panko)\
**Replies:** 1\
**Last updated:** [June 8, 2022, 7:53am UTC](https://discourse.processing.org/t/simple-iterative-list/37398 "2022-06-08T07:53:41Z")

</div>

Hi there - I am doing something a few times in a row. I feel like there must be a better way to write this. Can anyone help me? Thank you! PShape square1, square2, square3; void setup() { size(300, 300); // Crea…

---

## [Mouse click to add rows and columns to grid](https://discourse.processing.org/t/mouse-click-to-add-rows-and-columns-to-grid/37392)

<div class="topic-metadata">

**Author:** [@hues\_storm](https://discourse.processing.org/u/hues_storm)\
**Replies:** 2\
**Last updated:** [June 7, 2022, 9:09pm UTC](https://discourse.processing.org/t/mouse-click-to-add-rows-and-columns-to-grid/37392 "2022-06-07T21:09:49Z")

</div>

Hi, hope someone can help - I am trying to make a grid that when you mouse is clicked it adds another column and row - like an ever expanding grid - I have the base set up for a grid and i know i need a void mouseFuncti…

---

## [Need help w/ keyboard that take multiple inputs at once](https://discourse.processing.org/t/need-help-w-keyboard-that-take-multiple-inputs-at-once/37323)

<div class="topic-metadata">

**Author:** [@Mook](https://discourse.processing.org/u/Mook)\
**Replies:** 17\
**Last updated:** [June 7, 2022, 9:08pm UTC](https://discourse.processing.org/t/need-help-w-keyboard-that-take-multiple-inputs-at-once/37323 "2022-06-07T21:08:32Z")

</div>

I’m trying to make a program that can take for example, “LG” (pressed at the same time) as an input and output a unique letter. So far I’ve done the usual if (key == 108) { lDown = true; } if (key == 103) { gDown …

---

## [Storing Animation Frames in 2d Array](https://discourse.processing.org/t/storing-animation-frames-in-2d-array/37383)

<div class="topic-metadata">

**Author:** [@GloriousZero](https://discourse.processing.org/u/GloriousZero)\
**Replies:** 6\
**Last updated:** [June 7, 2022, 8:30pm UTC](https://discourse.processing.org/t/storing-animation-frames-in-2d-array/37383 "2022-06-07T20:30:41Z")

</div>

Currently creating an animation that responds on sound. The animation has 10 loops and 375 frames per loop. these frames are .jpg so to load them in i use a 2d array for( int i=0; i\<Phase; i++) { for( int j=0; j\<F…

---

## [How to count how long a key is pressed](https://discourse.processing.org/t/how-to-count-how-long-a-key-is-pressed/37375)

<div class="topic-metadata">

**Author:** [@gdt1k](https://discourse.processing.org/u/gdt1k)\
**Replies:** 10\
**Last updated:** [June 7, 2022, 9:37am UTC](https://discourse.processing.org/t/how-to-count-how-long-a-key-is-pressed/37375 "2022-06-07T09:37:25Z")

</div>

I’ve been trying to make a program that counts how long you’ve pressed a key. Is this possible in Processing Java? Here’s my code so far: int frames; void keyPressed() { frames++; } void keyReleased() { println(frames…

---

## ["String Index Out Of Bounds Exception: String index out of range: -1907998" Unknow error](https://discourse.processing.org/t/string-index-out-of-bounds-exception-string-index-out-of-range-1907998-unknow-error/37372)

<div class="topic-metadata">

**Author:** [@DybaTube](https://discourse.processing.org/u/DybaTube)\
**Replies:** 1\
**Last updated:** [June 6, 2022, 7:13pm UTC](https://discourse.processing.org/t/string-index-out-of-bounds-exception-string-index-out-of-range-1907998-unknow-error/37372 "2022-06-06T19:13:58Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I am trying to import my p5js code to processing, its almost working, but when i try to load the program it cames this error: StringIndexOutOfB…

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

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