# Coding Questions

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

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

**Page:** 45

---

## [Issue with fullScreen()](https://discourse.processing.org/t/issue-with-fullscreen/744)

<div class="topic-metadata">

**Author:** [@Fausto](https://discourse.processing.org/u/Fausto)\
**Replies:** 3\
**Last updated:** [September 15, 2021, 4:02pm UTC](https://discourse.processing.org/t/issue-with-fullscreen/744 "2021-09-15T16:02:32Z")

</div>

I have encountered a problem when using fullScreen(). For testing I have been given a small projector 800x600 connected to my Mac via thunderbolt to VGA adapter. I can see my second monitor projected, I can mouse over i…

---

## [Is it possible to determine a mouseclick order for buttons](https://discourse.processing.org/t/is-it-possible-to-determine-a-mouseclick-order-for-buttons/32254)

<div class="topic-metadata">

**Author:** [@seym](https://discourse.processing.org/u/seym)\
**Replies:** 4\
**Last updated:** [September 14, 2021, 10:41pm UTC](https://discourse.processing.org/t/is-it-possible-to-determine-a-mouseclick-order-for-buttons/32254 "2021-09-14T22:41:05Z")

</div>

I want to determine mouseclick orders for buttons, like: first click → on (conditions are true), second click → off, third click - \>on, … and it goes like this. But I could not figure a way to do this.

---

## [Surface Resize issues](https://discourse.processing.org/t/surface-resize-issues/32237)

<div class="topic-metadata">

**Author:** [@philspitler](https://discourse.processing.org/u/philspitler)\
**Replies:** 2\
**Last updated:** [September 13, 2021, 10:04pm UTC](https://discourse.processing.org/t/surface-resize-issues/32237 "2021-09-13T22:04:53Z")

</div>

Hi, I am having trouble changing the size of my surface in a sketch. Basically I load an image, set the surface size to the size of the image then draw circles on the surface. The issue is that Processing is actually s…

---

## [noLoop not working the way I expected](https://discourse.processing.org/t/noloop-not-working-the-way-i-expected/32174)

<div class="topic-metadata">

**Author:** [@philspitler](https://discourse.processing.org/u/philspitler)\
**Replies:** 8\
**Last updated:** [September 13, 2021, 6:34pm UTC](https://discourse.processing.org/t/noloop-not-working-the-way-i-expected/32174 "2021-09-13T18:34:08Z")

</div>

I have a simple sketch that opens and image, samples the pixels and redraws them with circles at set intervals. It works great in a loop but I only want it to process the image then stop. When I use the noLoop(); option…

---

## [Noisy gradients](https://discourse.processing.org/t/noisy-gradients/32217)

<div class="topic-metadata">

**Author:** [@dimpapadop](https://discourse.processing.org/u/dimpapadop)\
**Replies:** 4\
**Last updated:** [September 12, 2021, 1:18pm UTC](https://discourse.processing.org/t/noisy-gradients/32217 "2021-09-12T13:18:14Z")

</div>

hallo, i am wondering how a noise gradient like this that i found on the web could be created in processing. Any ideas? my idea approaching (so far) is using perlin noise field and blurring gradually. Anyone has a …

---

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

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 5\
**Last updated:** [September 12, 2021, 9:04am UTC](https://discourse.processing.org/t/image-not-showing/32204 "2021-09-12T09:04:53Z")

</div>

why is my enemy image not showing? //characters PImage\[\] midas= new PImage\[8\]; PImage\[\] daughter= new PImage\[3\]; PImage\[\] enemy= new PImage\[8\]; boolean showMidas1= true; //coordinates float midasx= 1; float midasy= 1;…

---

## [Change variable every other loop](https://discourse.processing.org/t/change-variable-every-other-loop/32212)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 2\
**Last updated:** [September 12, 2021, 9:44am UTC](https://discourse.processing.org/t/change-variable-every-other-loop/32212 "2021-09-12T09:44:07Z")

</div>

how do i make i3 equal 1, then make it equal 8 in the loop after, 1 again in the loop after and so forth?

---

## [Getting the average HSB from pixels](https://discourse.processing.org/t/getting-the-average-hsb-from-pixels/31965)

<div class="topic-metadata">

**Author:** [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Replies:** 33\
**Last updated:** [September 11, 2021, 4:21pm UTC](https://discourse.processing.org/t/getting-the-average-hsb-from-pixels/31965 "2021-09-11T16:21:39Z")

</div>

I have some simple code that is intended to find the average colour in a rectangle. That rectangle moves with the mouse. All is fine until I try to average two colours as in the example below. The Hue of half the sampl…

---

## [Show image if WASD is not pressed](https://discourse.processing.org/t/show-image-if-wasd-is-not-pressed/32168)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 16\
**Last updated:** [September 11, 2021, 5:20pm UTC](https://discourse.processing.org/t/show-image-if-wasd-is-not-pressed/32168 "2021-09-11T17:20:14Z")

</div>

when either w, a, s or d is pressed my code moves my image and cycles through different ones. i want it to show image "midas\[1\]’ if none of these buttons is pressed. i have a line of code if (key != 'w' && key!= 'a' && …

---

## [Different ways of multithreading](https://discourse.processing.org/t/different-ways-of-multithreading/32199)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 1\
**Last updated:** [September 11, 2021, 3:42pm UTC](https://discourse.processing.org/t/different-ways-of-multithreading/32199 "2021-09-11T15:42:28Z")

</div>

Hello everyone, I am aware of the use of thread(methodName) in processing for easy multithreading in a sketch, but this implementation of the thread class has limited functionality. You can’t put arguments into the funct…

---

## [Pixelated lines](https://discourse.processing.org/t/pixelated-lines/32186)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 3\
**Last updated:** [September 11, 2021, 3:03pm UTC](https://discourse.processing.org/t/pixelated-lines/32186 "2021-09-11T15:03:37Z")

</div>

Hi there! As you can see here, this lines are so pixelated, can you tell me why and how can I avoid it? Thank you so much! size(1000,1000); strokeWeight(20); background (255); for(int x=0;x\<1000;x=x+60){ stroke(0,0,0…

---

## [Can't run code due to syntax errors](https://discourse.processing.org/t/cant-run-code-due-to-syntax-errors/32193)

<div class="topic-metadata">

**Author:** [@mayyu](https://discourse.processing.org/u/mayyu)\
**Replies:** 3\
**Last updated:** [September 11, 2021, 9:32am UTC](https://discourse.processing.org/t/cant-run-code-due-to-syntax-errors/32193 "2021-09-11T09:32:57Z")

</div>

\< public class Person{ float x; float y; float xspeed; float yspeed; } Person (float tempX, float tempY) { x=tempX; y=tempY; xspeed = 4; yspeed = 4; } void move() { x = x+xspeed; if (x\>1000||x\<0){ xspeed=…

---

## [How can I fix stuttering. Is it due to unoptimized code?](https://discourse.processing.org/t/how-can-i-fix-stuttering-is-it-due-to-unoptimized-code/32160)

<div class="topic-metadata">

**Author:** [@DJx](https://discourse.processing.org/u/DJx)\
**Replies:** 13\
**Last updated:** [September 9, 2021, 10:51pm UTC](https://discourse.processing.org/t/how-can-i-fix-stuttering-is-it-due-to-unoptimized-code/32160 "2021-09-09T22:51:32Z")

</div>

Hi, so I’m making a game in Processing but unfortunately, I can’t seem to get the program to run smoothly. Sometimes it will stutter while running, while the next time be completely fine even though it is running the sam…

---

## [Array of images](https://discourse.processing.org/t/array-of-images/32120)

<div class="topic-metadata">

**Author:** [@tati1202](https://discourse.processing.org/u/tati1202)\
**Replies:** 6\
**Last updated:** [September 9, 2021, 8:48pm UTC](https://discourse.processing.org/t/array-of-images/32120 "2021-09-09T20:48:20Z")

</div>

PImage \[\] fotos= new PImage \[1\]; int nroImg; void setup(){ nroImg=0; size(700,700); for (int i=0; i\<fotos.length; i++){ fotos\[i\]=loadImage(“mr”+i+".jpg"); } } void draw(){ background(0); image(fotos\[nroImg\],0,…

---

## [Is there a way to read out code from old pde file?](https://discourse.processing.org/t/is-there-a-way-to-read-out-code-from-old-pde-file/32143)

<div class="topic-metadata">

**Author:** [@tlow001](https://discourse.processing.org/u/tlow001)\
**Replies:** 2\
**Last updated:** [September 9, 2021, 4:47pm UTC](https://discourse.processing.org/t/is-there-a-way-to-read-out-code-from-old-pde-file/32143 "2021-09-09T16:47:16Z")

</div>

Hello I want to pick up processing again after years of inactivity, but when I open an old file I get an error: I already tried to install an old veriosn of processing but I get the same result. Is there a way to g…

---

## [Not using Classes or Translate](https://discourse.processing.org/t/not-using-classes-or-translate/32161)

<div class="topic-metadata">

**Author:** [@UnsureNeedHelp](https://discourse.processing.org/u/UnsureNeedHelp)\
**Replies:** 2\
**Last updated:** [September 9, 2021, 10:48am UTC](https://discourse.processing.org/t/not-using-classes-or-translate/32161 "2021-09-09T10:48:46Z")

</div>

Hey all! I’ve got code here but we’ve not been allowed to use classes or transformations such as rotate, translate, scale etc. I really need help making this code work with these rules. Not sure where to even start, any…

---

## [Storing positions on an array and then calling the value (grid)](https://discourse.processing.org/t/storing-positions-on-an-array-and-then-calling-the-value-grid/32119)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 8\
**Last updated:** [September 8, 2021, 10:36pm UTC](https://discourse.processing.org/t/storing-positions-on-an-array-and-then-calling-the-value-grid/32119 "2021-09-08T22:36:43Z")

</div>

float xOffset = 0.0; float yOffset = 0.0; int rectSize = 30; int ellipseX = 90; int ellipseY = 320; int ellipseSize = 30; int boxPosX = 250; int boxPosY = 130; int spacingX = 45; int spacingY = 45; int i; int l; bo…

---

## [Help with noise map (terrain map)](https://discourse.processing.org/t/help-with-noise-map-terrain-map/32131)

<div class="topic-metadata">

**Author:** [@figle](https://discourse.processing.org/u/figle)\
**Replies:** 3\
**Last updated:** [September 8, 2021, 8:42pm UTC](https://discourse.processing.org/t/help-with-noise-map-terrain-map/32131 "2021-09-08T20:42:31Z")

</div>

Hi there, I’m trying to find a way to make an animated graphic similar in appearance to a poster I found online. Is there a way to programmatically make this noise map have more clustered areas and less noisy like here?…

---

## [Confine the wind in the screen without changing speed or degree](https://discourse.processing.org/t/confine-the-wind-in-the-screen-without-changing-speed-or-degree/32124)

<div class="topic-metadata">

**Author:** [@Arabesque0210](https://discourse.processing.org/u/Arabesque0210)\
**Replies:** 3\
**Last updated:** [September 7, 2021, 8:56pm UTC](https://discourse.processing.org/t/confine-the-wind-in-the-screen-without-changing-speed-or-degree/32124 "2021-09-07T20:56:28Z")

</div>

Hi there, I am new to processing and trying to create a floating text following wind data for my art project. I want to make sure this string is always in the screen like bouncing ball, however maybe cuz I use the real…

---

## [How can I create objects to make this work? (Spaceships)](https://discourse.processing.org/t/how-can-i-create-objects-to-make-this-work-spaceships/32017)

<div class="topic-metadata">

**Author:** [@lucaswoah](https://discourse.processing.org/u/lucaswoah)\
**Replies:** 2\
**Last updated:** [September 6, 2021, 9:02pm UTC](https://discourse.processing.org/t/how-can-i-create-objects-to-make-this-work-spaceships/32017 "2021-09-06T21:02:33Z")

</div>

So, I’m making this minigame where you have many spaceships on screen and their lights go out when you click them. I was able to make it work when you click the third spaceship (from the top to the bottom), but when I cl…

---

## [Drawing circles in random sequence](https://discourse.processing.org/t/drawing-circles-in-random-sequence/32077)

<div class="topic-metadata">

**Author:** [@jsco](https://discourse.processing.org/u/jsco)\
**Replies:** 14\
**Last updated:** [September 6, 2021, 7:53pm UTC](https://discourse.processing.org/t/drawing-circles-in-random-sequence/32077 "2021-09-06T19:53:13Z")

</div>

Hi, so I am just a beginner, so this may be a silly question. But in searching, I haven’t quite found what I want. I have a bunch of ellipses being drawn. Now I know they are drawn in the sequence they are written from …

---

## [Making rects disappear on touch](https://discourse.processing.org/t/making-rects-disappear-on-touch/32094)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 2\
**Last updated:** [September 5, 2021, 4:16pm UTC](https://discourse.processing.org/t/making-rects-disappear-on-touch/32094 "2021-09-05T16:16:17Z")

</div>

float xOffset = 0.0; float yOffset = 0.0; int rectSize = 30; int ellipseX = 90; int ellipseY = 320; int ellipseSize = 30; int boxPosX = 250; int boxPosY = 130; int spacingX = 45; int spacingY = 45; boolean ellipse…

---

## [How to force chrome to open a link?](https://discourse.processing.org/t/how-to-force-chrome-to-open-a-link/31617)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 3\
**Last updated:** [September 5, 2021, 8:30pm UTC](https://discourse.processing.org/t/how-to-force-chrome-to-open-a-link/31617 "2021-09-05T20:30:35Z")

</div>

Hi! I have been using a website that takes forever to load and has several other issues. I want to generate links and force them to open in browser. How can I do it (preferably in processing). I would prefer for it to be…

---

## [Frozen Pixels in Shaders?](https://discourse.processing.org/t/frozen-pixels-in-shaders/32038)

<div class="topic-metadata">

**Author:** [@bwerness](https://discourse.processing.org/u/bwerness)\
**Replies:** 10\
**Last updated:** [September 5, 2021, 7:55pm UTC](https://discourse.processing.org/t/frozen-pixels-in-shaders/32038 "2021-09-05T19:55:31Z")

</div>

Hello, I’m a long time Processing user and I’m currently getting extremely strange behavior from a shader I’m developing. I’ve stripped it down to the core, and I’ve simply never seen anything similar. When using the …

---

## [Chroma Library verification](https://discourse.processing.org/t/chroma-library-verification/32072)

<div class="topic-metadata">

**Author:** [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Replies:** 2\
**Last updated:** [September 5, 2021, 6:06pm UTC](https://discourse.processing.org/t/chroma-library-verification/32072 "2021-09-05T18:06:37Z")

</div>

If you go to \<https://github.com/neilpanchal/Chroma\> then scroll down to the section called Motivation, you will see an image. The text states, “The bottom row is generated in CIE-LCH color space by setting Luminosit…

---

## [Convert PImage to byte array](https://discourse.processing.org/t/convert-pimage-to-byte-array/20268)

<div class="topic-metadata">

**Author:** [@Marce](https://discourse.processing.org/u/Marce)\
**Replies:** 17\
**Last updated:** [September 5, 2021, 10:23am UTC](https://discourse.processing.org/t/convert-pimage-to-byte-array/20268 "2021-09-05T10:23:19Z")

</div>

Hi ! I’m looking for a way to convert a Pimage to a byte array. I feel like this should be a pretty common things to do, and I tried plenty of things found online but, not a single one seems to work. If anyone knows h…

---

## [Starting from straight line and curling into a spiral](https://discourse.processing.org/t/starting-from-straight-line-and-curling-into-a-spiral/32084)

<div class="topic-metadata">

**Author:** [@endymion](https://discourse.processing.org/u/endymion)\
**Replies:** 3\
**Last updated:** [September 4, 2021, 11:35pm UTC](https://discourse.processing.org/t/starting-from-straight-line-and-curling-into-a-spiral/32084 "2021-09-04T23:35:23Z")

</div>

Hi, I want to create a simple animation that starts with a line and the line slowly curls into a spiral. I thought initially that I might be able to do this by making multiple curveVertex segments and rotating the coordi…

---

## [Rect not showing](https://discourse.processing.org/t/rect-not-showing/32092)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 1\
**Last updated:** [September 4, 2021, 6:18pm UTC](https://discourse.processing.org/t/rect-not-showing/32092 "2021-09-04T18:18:25Z")

</div>

int rectY = 400; int rectX = 100; void setup () { size (500, 350); } void draw() { background (0); fill(255, 100, 100); rect(rectX, rectY, 100, 100); } this is my code, I dont know what I did wrong. Probably…

---

## [Unable to update pixels from text file containing pixel locations](https://discourse.processing.org/t/unable-to-update-pixels-from-text-file-containing-pixel-locations/2021)

<div class="topic-metadata">

**Author:** [@socraticbot](https://discourse.processing.org/u/socraticbot)\
**Replies:** 8\
**Last updated:** [September 4, 2021, 6:01pm UTC](https://discourse.processing.org/t/unable-to-update-pixels-from-text-file-containing-pixel-locations/2021 "2021-09-04T18:01:15Z")

</div>

Hi all, I wrote a program in Processing which writes the 1D coordinates of black pixels in an image to a text file. I wrote a second program which should read the text file and recreate the black pixels on a white imag…

---

## [Vignette effect only being applied vertically](https://discourse.processing.org/t/vignette-effect-only-being-applied-vertically/32071)

<div class="topic-metadata">

**Author:** [@raspberrybrick](https://discourse.processing.org/u/raspberrybrick)\
**Replies:** 2\
**Last updated:** [September 4, 2021, 1:51am UTC](https://discourse.processing.org/t/vignette-effect-only-being-applied-vertically/32071 "2021-09-04T01:51:55Z")

</div>

Hello, Currently I am trying to create a vignette effect, and have been somewhat successful. Most tutorials/examples I have found are either black and white, or use the point() function to draw each pixel. However neit…

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

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