# Coding Questions

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

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

**Page:** 20

---

## [Balls wait problem](https://discourse.processing.org/t/balls-wait-problem/40047)

<div class="topic-metadata">

**Author:** [@SYN1810](https://discourse.processing.org/u/SYN1810)\
**Replies:** 1\
**Last updated:** [December 7, 2022, 10:54am UTC](https://discourse.processing.org/t/balls-wait-problem/40047 "2022-12-07T10:54:56Z")

</div>

Hello, now I am making a game of hunting a ball, what happens is that the balls do not stay on the screen, but new ones are written continuously, I wanted to do it by myself but I have not succeeded, the objective is tha…

---

## ['Rotate' gradient background](https://discourse.processing.org/t/rotate-gradient-background/39989)

<div class="topic-metadata">

**Author:** [@Erif](https://discourse.processing.org/u/Erif)\
**Replies:** 11\
**Last updated:** [December 6, 2022, 8:48pm UTC](https://discourse.processing.org/t/rotate-gradient-background/39989 "2022-12-06T20:48:23Z")

</div>

Hi, Quick simple question I’m sure but somehow I can’t manage to make it work. This code below shows a green to red gradient background from bottom left to top right. How can I make it go from bottom right to top left…

---

## [Drawing Fibonacci Spiral with SVG that Changes Angles](https://discourse.processing.org/t/drawing-fibonacci-spiral-with-svg-that-changes-angles/40038)

<div class="topic-metadata">

**Author:** [@DDe](https://discourse.processing.org/u/DDe)\
**Replies:** 4\
**Last updated:** [December 6, 2022, 4:09pm UTC](https://discourse.processing.org/t/drawing-fibonacci-spiral-with-svg-that-changes-angles/40038 "2022-12-06T16:09:57Z")

</div>

Hey hey, obviously I’m new to proccessing but long story short, I am trying to replace the line/points drawn out for a Fibonnaci Spiral with an svg file of my design, but I’m struggling to make that work. I have some cod…

---

## [Bug? shapes in P2D](https://discourse.processing.org/t/bug-shapes-in-p2d/39976)

<div class="topic-metadata">

**Author:** [@zzabel8](https://discourse.processing.org/u/zzabel8)\
**Replies:** 1\
**Last updated:** [December 6, 2022, 8:53am UTC](https://discourse.processing.org/t/bug-shapes-in-p2d/39976 "2022-12-06T08:53:28Z")

</div>

When you run this code it draws a linear line and a ball that jumps around with ‘a’ and ‘d’. The line is drawn in the for loop. Running this works just fine, but if you change the conditional in the for loop to 1250 inst…

---

## [Calculation the color density of an image](https://discourse.processing.org/t/calculation-the-color-density-of-an-image/40021)

<div class="topic-metadata">

**Author:** [@jaspervb](https://discourse.processing.org/u/jaspervb)\
**Replies:** 5\
**Last updated:** [December 6, 2022, 1:11am UTC](https://discourse.processing.org/t/calculation-the-color-density-of-an-image/40021 "2022-12-06T01:11:14Z")

</div>

Hi There, Is there a way to calculate the percentages of the colors in an image, for example in a logo. If it is possible i want to translate those color percentage values into rectangles. I hope to hear from you. Ki…

---

## [Sort method of the Table Class doesn’t work correctly](https://discourse.processing.org/t/sort-method-of-the-table-class-doesn-t-work-correctly/40031)

<div class="topic-metadata">

**Author:** [@Schiffmann](https://discourse.processing.org/u/Schiffmann)\
**Replies:** 1\
**Last updated:** [December 5, 2022, 1:43pm UTC](https://discourse.processing.org/t/sort-method-of-the-table-class-doesn-t-work-correctly/40031 "2022-12-05T13:43:30Z")

</div>

Hello, I wrote a program that should sort a table according a column with int values that were initialised in descending order, starting with 100000. Unfortunately the result is wrong while by excel or numbers it can be…

---

## [How can I rotate all of this](https://discourse.processing.org/t/how-can-i-rotate-all-of-this/40015)

<div class="topic-metadata">

**Author:** [@returng](https://discourse.processing.org/u/returng)\
**Replies:** 1\
**Last updated:** [December 3, 2022, 10:57pm UTC](https://discourse.processing.org/t/how-can-i-rotate-all-of-this/40015 "2022-12-03T22:57:25Z")

</div>

I want to rotate my snowflake with mouseX, here is the full code; float angle = 0; float cx; float cy; void setup() { size(640, 480); cx = 50; cy = height/2; noLoop(); } void draw() { background(255); …

---

## [PDF of P3D Processing sketch](https://discourse.processing.org/t/pdf-of-p3d-processing-sketch/39996)

<div class="topic-metadata">

**Author:** [@asymmetric](https://discourse.processing.org/u/asymmetric)\
**Replies:** 13\
**Last updated:** [December 4, 2022, 1:32am UTC](https://discourse.processing.org/t/pdf-of-p3d-processing-sketch/39996 "2022-12-04T01:32:41Z")

</div>

I’m finding it difficult to create a PDF from the PDF library when my sketch specifies P2D or P3D. What am I doing wrong? import processing.pdf.\*; boolean record; void setup(){ size(1500,800,P3D); frameRate(1); …

---

## [Does anyone know what is wrong with this program?](https://discourse.processing.org/t/does-anyone-know-what-is-wrong-with-this-program/40012)

<div class="topic-metadata">

**Author:** [@add](https://discourse.processing.org/u/add)\
**Replies:** 2\
**Last updated:** [December 3, 2022, 8:45pm UTC](https://discourse.processing.org/t/does-anyone-know-what-is-wrong-with-this-program/40012 "2022-12-03T20:45:44Z")

</div>

int h,m; void setup(){ size (800,600); frameRate(10); } void draw (){ // if (framec==0){ background (180); stroke (0); fill(255); rect (0,500,width,height);//chenar jos h=nf(hits); m=nf(misses); f…

---

## [Loading a random image for every different screen in Processing](https://discourse.processing.org/t/loading-a-random-image-for-every-different-screen-in-processing/40004)

<div class="topic-metadata">

**Author:** [@onosecond](https://discourse.processing.org/u/onosecond)\
**Replies:** 1\
**Last updated:** [December 3, 2022, 7:22am UTC](https://discourse.processing.org/t/loading-a-random-image-for-every-different-screen-in-processing/40004 "2022-12-03T07:22:34Z")

</div>

Hi everyone! Please note that I am a beginner :slight\_smile: I am trying to find how to change the background to a different image every time the screen changes. A bit of context: I am trying to make a quiz game, and e…

---

## [Bouncing gradient](https://discourse.processing.org/t/bouncing-gradient/39090)

<div class="topic-metadata">

**Author:** [@gradientquestion](https://discourse.processing.org/u/gradientquestion)\
**Replies:** 3\
**Last updated:** [December 2, 2022, 6:18pm UTC](https://discourse.processing.org/t/bouncing-gradient/39090 "2022-12-02T18:18:58Z")

</div>

Hello ! I am a beginner on processing, I need to make a moving gradient with 3 RGB codes. pink: 247,211,237 blue: 156,217,204 white: 255,251,233 I found this code here : https://happycoding.io/examples/processing/fo…

---

## [Mac - red close window dot - how set modified?](https://discourse.processing.org/t/mac-red-close-window-dot-how-set-modified/39970)

<div class="topic-metadata">

**Author:** [@Svedblen](https://discourse.processing.org/u/Svedblen)\
**Replies:** 12\
**Last updated:** [December 2, 2022, 11:38am UTC](https://discourse.processing.org/t/mac-red-close-window-dot-how-set-modified/39970 "2022-12-02T11:38:00Z")

</div>

Hi, I’m running (Java) Processing on a Mac and I would like to be able to set the black tiny dot inside the red Close Window dot when my application is “modified”. Any ideas on how to manage that? Thanks

---

## [Consistent patterns when using random](https://discourse.processing.org/t/consistent-patterns-when-using-random/39950)

<div class="topic-metadata">

**Author:** [@travis.stdenis](https://discourse.processing.org/u/travis.stdenis)\
**Replies:** 2\
**Last updated:** [December 1, 2022, 2:02am UTC](https://discourse.processing.org/t/consistent-patterns-when-using-random/39950 "2022-12-01T02:02:40Z")

</div>

I am designing a generative wreath. In it i want to randomly add a berry to the end of needles some of the time. However, the random() function is producing consistent patterns (see lines of berries in the image), usuall…

---

## [Hex color fill()](https://discourse.processing.org/t/hex-color-fill/39940)

<div class="topic-metadata">

**Author:** [@add](https://discourse.processing.org/u/add)\
**Replies:** 2\
**Last updated:** [November 30, 2022, 11:54am UTC](https://discourse.processing.org/t/hex-color-fill/39940 "2022-11-30T11:54:22Z")

</div>

Hi! I want the circle to be filled with hex colors depending on the quadrant where the mouse is located, but I don’t know what variables to put in the function drawCircle(), the program only works with RGB. so, what sho…

---

## [Please can someone help a poor old artist :)](https://discourse.processing.org/t/please-can-someone-help-a-poor-old-artist/11094)

<div class="topic-metadata">

**Author:** [@PhilDaniels](https://discourse.processing.org/u/PhilDaniels)\
**Replies:** 17\
**Last updated:** [November 30, 2022, 10:56am UTC](https://discourse.processing.org/t/please-can-someone-help-a-poor-old-artist/11094 "2022-11-30T10:56:21Z")

</div>

Hi All I am a professional artist from Norfolk, UK. I am trying to make some high definition stencils and stumbled across a chaps website that gave some info and details on processing and a script that he had made with…

---

## ['Spin the bottle' - 360 degrees with PVector](https://discourse.processing.org/t/spin-the-bottle-360-degrees-with-pvector/39872)

<div class="topic-metadata">

**Author:** [@acousticer](https://discourse.processing.org/u/acousticer)\
**Replies:** 6\
**Last updated:** [November 30, 2022, 12:42am UTC](https://discourse.processing.org/t/spin-the-bottle-360-degrees-with-pvector/39872 "2022-11-30T00:42:04Z")

</div>

Can someone please tell me what I’m missing here to make this spin 360 degrees. I was able to do it without using PVectors but it doesn’t seem to work when I alter with code with PVectors. I’m still just getting the hang…

---

## [Returning PVector from a function](https://discourse.processing.org/t/returning-pvector-from-a-function/39883)

<div class="topic-metadata">

**Author:** [@Mijin](https://discourse.processing.org/u/Mijin)\
**Replies:** 8\
**Last updated:** [November 29, 2022, 11:31am UTC](https://discourse.processing.org/t/returning-pvector-from-a-function/39883 "2022-11-29T11:31:38Z")

</div>

Hi guys, What is the best practice for functions that need to return a PVector, given that it’s a reference type? Consider the below code void SomeBigCalculation () { // Just temporarily need to know the relative p…

---

## [Why can't I draw both figures when the line moves? How to use if/else vs switch statement](https://discourse.processing.org/t/why-cant-i-draw-both-figures-when-the-line-moves-how-to-use-if-else-vs-switch-statement/39919)

<div class="topic-metadata">

**Author:** [@add](https://discourse.processing.org/u/add)\
**Replies:** 2\
**Last updated:** [November 28, 2022, 8:58pm UTC](https://discourse.processing.org/t/why-cant-i-draw-both-figures-when-the-line-moves-how-to-use-if-else-vs-switch-statement/39919 "2022-11-28T20:58:35Z")

</div>

int v=1,a = 0,r=50; void setup(){ size(200,200); frameRate= 30; } void draw() { background(200); a = (a + 1) % height; // 'a' increases between 0 and width line(0, a, width, a); stroke(0); strokeWeight …

---

## [Random changing character](https://discourse.processing.org/t/random-changing-character/39887)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 7\
**Last updated:** [November 28, 2022, 9:02am UTC](https://discourse.processing.org/t/random-changing-character/39887 "2022-11-28T09:02:59Z")

</div>

Hi there! I want yo do a changing random character. I have done this and It starts working char c = 33; c += random(93); size(500, 500); textSize(128); text(c, 250, 250); Then, I try to animate It, I wan…

---

## [Scaling a CSV to screen](https://discourse.processing.org/t/scaling-a-csv-to-screen/39906)

<div class="topic-metadata">

**Author:** [@Rbu](https://discourse.processing.org/u/Rbu)\
**Replies:** 3\
**Last updated:** [November 27, 2022, 11:07pm UTC](https://discourse.processing.org/t/scaling-a-csv-to-screen/39906 "2022-11-27T23:07:08Z")

</div>

Hello I’m on a project at the moment and I’m importing and using data from a CSV file, the problem I have is that the coordinates within the screen are to large and end up off screen, I need some advice on rescaling the …

---

## [Use loadTable with variable like String, String\[\], String\[\]\[\], StringList?](https://discourse.processing.org/t/use-loadtable-with-variable-like-string-string-string-stringlist/12457)

<div class="topic-metadata">

**Author:** [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Replies:** 7\
**Last updated:** [November 27, 2022, 11:05pm UTC](https://discourse.processing.org/t/use-loadtable-with-variable-like-string-string-string-stringlist/12457 "2022-11-27T23:05:26Z")

</div>

Does anyone know if you can use loadTable() to generate a Table using a local variable rather than a file as input? For example if you have CSV-like data stored in a String, or a String\[\] (per row), or a String\[\]\[\] (per…

---

## [Game over screen problem in a game](https://discourse.processing.org/t/game-over-screen-problem-in-a-game/39903)

<div class="topic-metadata">

**Author:** [@processinglearner](https://discourse.processing.org/u/processinglearner)\
**Replies:** 4\
**Last updated:** [November 27, 2022, 7:03pm UTC](https://discourse.processing.org/t/game-over-screen-problem-in-a-game/39903 "2022-11-27T19:03:52Z")

</div>

hi! I made one game with loop.And there is game screen in the end.But this screen should be active for 5 seconds in the loop.My code is like this: void draw() { ... if( frameCount / 60 == 3 ) { fill(255, 0, 255);…

---

## [Programming advice (spiral from point to point)](https://discourse.processing.org/t/programming-advice-spiral-from-point-to-point/37628)

<div class="topic-metadata">

**Author:** [@Rbu](https://discourse.processing.org/u/Rbu)\
**Replies:** 16\
**Last updated:** [November 27, 2022, 11:04am UTC](https://discourse.processing.org/t/programming-advice-spiral-from-point-to-point/37628 "2022-11-27T11:04:32Z")

</div>

Hello, I am looking to start a programming project. But stuck at the first I want to program a progressive circle that follows a line. I will add a picture because im unsure how to explain.

---

## [Change colors on different objects blinking](https://discourse.processing.org/t/change-colors-on-different-objects-blinking/39832)

<div class="topic-metadata">

**Author:** [@vrtx](https://discourse.processing.org/u/vrtx)\
**Replies:** 8\
**Last updated:** [November 27, 2022, 2:19am UTC](https://discourse.processing.org/t/change-colors-on-different-objects-blinking/39832 "2022-11-27T02:19:35Z")

</div>

Hello, I need help to change the colors! i am trynig to make a differents objects like a rect, circle, triangle, blink/flash with diferent colors, I am till now, can do it with black and white. As the code below i show…

---

## [In the Processing ball game, the movements of the balls are limited](https://discourse.processing.org/t/in-the-processing-ball-game-the-movements-of-the-balls-are-limited/39890)

<div class="topic-metadata">

**Author:** [@Huginn](https://discourse.processing.org/u/Huginn)\
**Replies:** 1\
**Last updated:** [November 26, 2022, 10:25pm UTC](https://discourse.processing.org/t/in-the-processing-ball-game-the-movements-of-the-balls-are-limited/39890 "2022-11-26T22:25:01Z")

</div>

float xPos = 400; float yPos = 300; float xPos2 = 0; float yPos2 = 300; int radius = 50; int x1, y1, x2, y2; float theta = 0f; int speedX = 2; int speedY = 2; int x1\_, y1\_, x2\_, y2\_; float theta\_ = 0f; int speedX\_ …

---

## [Frogger - Need help with moving obstacles](https://discourse.processing.org/t/frogger-need-help-with-moving-obstacles/39874)

<div class="topic-metadata">

**Author:** [@kemne](https://discourse.processing.org/u/kemne)\
**Replies:** 1\
**Last updated:** [November 26, 2022, 2:00pm UTC](https://discourse.processing.org/t/frogger-need-help-with-moving-obstacles/39874 "2022-11-26T14:00:56Z")

</div>

Hi, I’m currently working on an assignment about creating the game Frogger. So I got my frog and the obstacles that my frog will need to avoid. Regardings the movement of my obstacles, the requirement is that I need to …

---

## [Issues with loading fonts with CreateFonts](https://discourse.processing.org/t/issues-with-loading-fonts-with-createfonts/39862)

<div class="topic-metadata">

**Author:** [@bardo](https://discourse.processing.org/u/bardo)\
**Replies:** 11\
**Last updated:** [November 26, 2022, 12:54am UTC](https://discourse.processing.org/t/issues-with-loading-fonts-with-createfonts/39862 "2022-11-26T00:54:29Z")

</div>

Hi there, I am having issues loading fonts that I have installed on my Windows fonts folder . The message that I get every time is " “PPEiko-Medium” is not available, so another font will be used. Use PFont.list() to …

---

## [Can you help me making this game with codes](https://discourse.processing.org/t/can-you-help-me-making-this-game-with-codes/39849)

<div class="topic-metadata">

**Author:** [@processinglearner](https://discourse.processing.org/u/processinglearner)\
**Replies:** 4\
**Last updated:** [November 24, 2022, 11:26am UTC](https://discourse.processing.org/t/can-you-help-me-making-this-game-with-codes/39849 "2022-11-24T11:26:26Z")

</div>

Simulate two numbers of balls with a certain radius both colliding with the 4 sides of the screen and colliding with the balls themselves. At the moment of collision, the balls must move in the opposite direction. A prog…

---

## [Cloud of random letters](https://discourse.processing.org/t/cloud-of-random-letters/39837)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 19\
**Last updated:** [November 24, 2022, 8:45am UTC](https://discourse.processing.org/t/cloud-of-random-letters/39837 "2022-11-24T08:45:20Z")

</div>

Hi there I have done this chart with letters but what I really want yo do its a cloud with hundred of letters disorganized around the screen. How could I do something like that? Thanks size(1000,1000); background(255)…

---

## [Ensemble of points with noise](https://discourse.processing.org/t/ensemble-of-points-with-noise/39842)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 1\
**Last updated:** [November 24, 2022, 12:58am UTC](https://discourse.processing.org/t/ensemble-of-points-with-noise/39842 "2022-11-24T00:58:11Z")

</div>

Hi there I am using noise function as a beguinner and I would like to make this group of points bigger, beyond the size limits of the screen. Changing number 1000 here and there does not work, so could you please tell m…

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

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