# Coding Questions

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

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

**Page:** 58

---

## [P2D vs JAVA2D Source-over alpha problems](https://discourse.processing.org/t/p2d-vs-java2d-source-over-alpha-problems/28957)

<div class="topic-metadata">

**Author:** [@plutovman](https://discourse.processing.org/u/plutovman)\
**Replies:** 4\
**Last updated:** [April 2, 2021, 7:24pm UTC](https://discourse.processing.org/t/p2d-vs-java2d-source-over-alpha-problems/28957 "2021-04-02T19:24:06Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I know this question has been asked in one form of another, but I wanted to pose it here in terms of getting the default blend drawing mode to w…

---

## [Drawing PImages or PShapes with color modulation](https://discourse.processing.org/t/drawing-pimages-or-pshapes-with-color-modulation/29052)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 8\
**Last updated:** [April 2, 2021, 3:28pm UTC](https://discourse.processing.org/t/drawing-pimages-or-pshapes-with-color-modulation/29052 "2021-04-02T15:28:25Z")

</div>

is there any native way to print a PImage (or a PShape) with additional arguments to change the hue saturation or brightness? i would love to be able to do like image(file,x,y,w,h,hueShift,saturationShift,brightnessShift…

---

## [How to incorporate exponential curve with a specified limit?](https://discourse.processing.org/t/how-to-incorporate-exponential-curve-with-a-specified-limit/28995)

<div class="topic-metadata">

**Author:** [@leatherbird](https://discourse.processing.org/u/leatherbird)\
**Replies:** 5\
**Last updated:** [April 2, 2021, 3:39am UTC](https://discourse.processing.org/t/how-to-incorporate-exponential-curve-with-a-specified-limit/28995 "2021-04-02T03:39:09Z")

</div>

Hello! I’m playing with randomGaussians, and gradual transitions, trying to understand the concept, and I’ve hit a bit of a snag. I’m hoping someone can help with the math involved. I’m drawing simple squares in a gri…

---

## [Processing in Kotlin with static main function error](https://discourse.processing.org/t/processing-in-kotlin-with-static-main-function-error/29039)

<div class="topic-metadata">

**Author:** [@sharpeye](https://discourse.processing.org/u/sharpeye)\
**Replies:** 1\
**Last updated:** [April 1, 2021, 7:21am UTC](https://discourse.processing.org/t/processing-in-kotlin-with-static-main-function-error/29039 "2021-04-01T07:21:20Z")

</div>

Hi ,I’m a Processing learners from China，and I am experimenting with writing prcoessing cod in Kotlin environment。But some problems that are pressing on me，like this one :crazy\_face: I want to code the pde Imitate the s…

---

## [Smart-ish bouncing ball](https://discourse.processing.org/t/smart-ish-bouncing-ball/28927)

<div class="topic-metadata">

**Author:** [@scolty2021](https://discourse.processing.org/u/scolty2021)\
**Replies:** 6\
**Last updated:** [March 31, 2021, 9:13pm UTC](https://discourse.processing.org/t/smart-ish-bouncing-ball/28927 "2021-03-31T21:13:36Z")

</div>

Hello, Thanks for taking the time to click on this query. I’m currently learning how to bounce balls around the window, and wondered whether it is possible to make the ball see the trail it leaves behind it and interac…

---

## [Need Help Implementing a Billboard Effect for a Circle](https://discourse.processing.org/t/need-help-implementing-a-billboard-effect-for-a-circle/28989)

<div class="topic-metadata">

**Author:** [@topologen](https://discourse.processing.org/u/topologen)\
**Replies:** 7\
**Last updated:** [March 31, 2021, 2:28pm UTC](https://discourse.processing.org/t/need-help-implementing-a-billboard-effect-for-a-circle/28989 "2021-03-31T14:28:00Z")

</div>

Hey guys! This is my first post here so let me know if I need to change anything. I’ve almost finished a project and I’ve hit a pretty big hurdle (for me anyway haha). I wanted to write some code that will outline a sph…

---

## [Speed in which Brightness changes defined by mouseX](https://discourse.processing.org/t/speed-in-which-brightness-changes-defined-by-mousex/29007)

<div class="topic-metadata">

**Author:** [@p\_a](https://discourse.processing.org/u/p_a)\
**Replies:** 2\
**Last updated:** [March 31, 2021, 10:59am UTC](https://discourse.processing.org/t/speed-in-which-brightness-changes-defined-by-mousex/29007 "2021-03-31T10:59:34Z")

</div>

Hi, I made the brightness (HSB Mode) of an ellipse change up and down between 0 and 100 BUT I want to change the speed in which the brightness changes defined by mouseX. Here is my code so far, I just don’t know how t…

---

## [Could this made with processing](https://discourse.processing.org/t/could-this-made-with-processing/29001)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 2\
**Last updated:** [March 31, 2021, 5:02am UTC](https://discourse.processing.org/t/could-this-made-with-processing/29001 "2021-03-31T05:02:36Z")

</div>

hi i wonder if this could achieve with processing Bx\[x\_, z\_, R\_\] = If\[Abs\[x/R\] \< 10^-5, 0, z/(2 Pi x) (\\\[Beta\] = (x + R)^2 + z^2; m = 4 x\*R/\\\[Beta\]; 1/Sqrt\[\\\[Beta\]\] ((R^2 + x^2 + z^2)/((R - x)^2 + z^2) El…

---

## [Function to extract colors from coolors.co](https://discourse.processing.org/t/function-to-extract-colors-from-coolors-co/28986)

<div class="topic-metadata">

**Author:** [@thesandrobrito](https://discourse.processing.org/u/thesandrobrito)\
**Replies:** 3\
**Last updated:** [March 31, 2021, 1:41am UTC](https://discourse.processing.org/t/function-to-extract-colors-from-coolors-co/28986 "2021-03-31T01:41:18Z")

</div>

Hi everyone. I was trying to come up with a function to extract colours from the URL from coolors.com to easily change colour pallets. This is an idea I’ve seen done for P5 projects, but I’d like it for Processing. For…

---

## [Terrain Generation](https://discourse.processing.org/t/terrain-generation/28740)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 14\
**Last updated:** [March 30, 2021, 8:03pm UTC](https://discourse.processing.org/t/terrain-generation/28740 "2021-03-30T20:03:02Z")

</div>

hi all how to make this shape if any one can help i found this equation : centerpoint (x1, y1) and a radius r, the height of the hill at the point (x2, y2) is equivalent to: how to use it to form this terrain ca…

---

## [How to create a buttons](https://discourse.processing.org/t/how-to-create-a-buttons/28952)

<div class="topic-metadata">

**Author:** [@Pokeyace](https://discourse.processing.org/u/Pokeyace)\
**Replies:** 10\
**Last updated:** [March 30, 2021, 5:55am UTC](https://discourse.processing.org/t/how-to-create-a-buttons/28952 "2021-03-30T05:55:29Z")

</div>

— create a program that will display four radio buttons, each represented by a circle and accompanying text. — when the user clicks on a circle, it is shown as being filled in. If another circle was previously filled in…

---

## [Achieving a noodle shape](https://discourse.processing.org/t/achieving-a-noodle-shape/28922)

<div class="topic-metadata">

**Author:** [@thesandrobrito](https://discourse.processing.org/u/thesandrobrito)\
**Replies:** 6\
**Last updated:** [March 29, 2021, 10:23am UTC](https://discourse.processing.org/t/achieving-a-noodle-shape/28922 "2021-03-29T10:23:13Z")

</div>

I’d like to achieve shapes like this, to simulate flowing “noodles” and I’d like to be able to control fill and stroke, so I’d assume it needs to be a shape, but I have no idea how to do it. My initial thinking was to j…

---

## [Constrain one end of sine wave](https://discourse.processing.org/t/constrain-one-end-of-sine-wave/28914)

<div class="topic-metadata">

**Author:** [@brewthom](https://discourse.processing.org/u/brewthom)\
**Replies:** 3\
**Last updated:** [March 28, 2021, 11:33pm UTC](https://discourse.processing.org/t/constrain-one-end-of-sine-wave/28914 "2021-03-28T23:33:58Z")

</div>

I’m trying to figure out how to constrain one end of a sine wave so that the left end of the wave animation is “tied” to the mouse x and mouse y. I’m thinking i need PVectors, but not sure how to implement that. I’ve wor…

---

## [Removing objects once out of the canvas](https://discourse.processing.org/t/removing-objects-once-out-of-the-canvas/28884)

<div class="topic-metadata">

**Author:** [@yannisky](https://discourse.processing.org/u/yannisky)\
**Replies:** 8\
**Last updated:** [March 28, 2021, 5:41pm UTC](https://discourse.processing.org/t/removing-objects-once-out-of-the-canvas/28884 "2021-03-28T17:41:45Z")

</div>

Hello Forum! I made an object and class sketch to randomly generate curved vertex object in P3D. This is eventually goes over a movie. it works fine BUT after about a hundred or so times it gets called up (with the spa…

---

## [Flocking as in NatureOfCode](https://discourse.processing.org/t/flocking-as-in-natureofcode/28912)

<div class="topic-metadata">

**Author:** [@manno](https://discourse.processing.org/u/manno)\
**Replies:** 5\
**Last updated:** [March 27, 2021, 11:37pm UTC](https://discourse.processing.org/t/flocking-as-in-natureofcode/28912 "2021-03-27T23:37:40Z")

</div>

Question on flocking. In many examples (and also on The Nature of Code) there’s something like: if (count \> 0) { sum.div(count); sum.normalize(); sum.mult(maxspeed); PVector steer = PVector.sub(…

---

## [Displaying image on mouse click](https://discourse.processing.org/t/displaying-image-on-mouse-click/28906)

<div class="topic-metadata">

**Author:** [@Daphn](https://discourse.processing.org/u/Daphn)\
**Replies:** 1\
**Last updated:** [March 27, 2021, 7:42pm UTC](https://discourse.processing.org/t/displaying-image-on-mouse-click/28906 "2021-03-27T19:42:03Z")

</div>

Hello! This is my first time using processing and I can’t work my problem out. Hopefully someone can help! I am trying to display an image that follows the cursor of the mouse, and when the mouse is clicked I want a fl…

---

## [Why is this ui function crashing my sketch when i build](https://discourse.processing.org/t/why-is-this-ui-function-crashing-my-sketch-when-i-build/28871)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 13\
**Last updated:** [March 27, 2021, 2:30pm UTC](https://discourse.processing.org/t/why-is-this-ui-function-crashing-my-sketch-when-i-build/28871 "2021-03-27T14:30:25Z")

</div>

i have a function called uiUpdate that runs fine in the preview but freezes the app when i build it. i know this function is responsible, but i don’t know why. here is the entire ui class, i have to comment out every uiU…

---

## [Quad\_Strip: Okay, but how to do a line break in a bigger grid with Quad\_Strip?](https://discourse.processing.org/t/quad-strip-okay-but-how-to-do-a-line-break-in-a-bigger-grid-with-quad-strip/28623)

<div class="topic-metadata">

**Author:** [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Replies:** 4\
**Last updated:** [March 27, 2021, 10:26am UTC](https://discourse.processing.org/t/quad-strip-okay-but-how-to-do-a-line-break-in-a-bigger-grid-with-quad-strip/28623 "2021-03-27T10:26:36Z")

</div>

Hello all, the reference has Quad\_Strip, but only for one line of quads. How can I make a bigger grid of QUAD\_STRIP? Actually, the main problem is the line break at the end of one line in the grid. I don’t want the ri…

---

## [How to add color for 3d terrain](https://discourse.processing.org/t/how-to-add-color-for-3d-terrain/28548)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 37\
**Last updated:** [March 27, 2021, 8:33am UTC](https://discourse.processing.org/t/how-to-add-color-for-3d-terrain/28548 "2021-03-27T08:33:59Z")

</div>

hi i need help how to make colors like this ?? thanks in advance

---

## [saveFrame function using background image and p3d](https://discourse.processing.org/t/saveframe-function-using-background-image-and-p3d/28889)

<div class="topic-metadata">

**Author:** [@kiernan](https://discourse.processing.org/u/kiernan)\
**Replies:** 5\
**Last updated:** [March 27, 2021, 2:45am UTC](https://discourse.processing.org/t/saveframe-function-using-background-image-and-p3d/28889 "2021-03-27T02:45:04Z")

</div>

I am having trouble using saveFrame to record a sketch which uses p3d with a background image. When I use saveFrame without the background image everything is captured fine and shows the sketch but when I put the backgro…

---

## [Ball bounces off the movable bats (extended PONG version)](https://discourse.processing.org/t/ball-bounces-off-the-movable-bats-extended-pong-version/28882)

<div class="topic-metadata">

**Author:** [@programmer](https://discourse.processing.org/u/programmer)\
**Replies:** 1\
**Last updated:** [March 26, 2021, 7:21pm UTC](https://discourse.processing.org/t/ball-bounces-off-the-movable-bats-extended-pong-version/28882 "2021-03-26T19:21:10Z")

</div>

I am creating an advanced version of the game Pong, where the bats can also move in the x-direction. I am trying to write a code to make the ball bounce off the bats on all four sides of the two bats. I was just able to …

---

## [How can i load image files in processing without crashing the build](https://discourse.processing.org/t/how-can-i-load-image-files-in-processing-without-crashing-the-build/28870)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 5\
**Last updated:** [March 26, 2021, 1:37pm UTC](https://discourse.processing.org/t/how-can-i-load-image-files-in-processing-without-crashing-the-build/28870 "2021-03-26T13:37:07Z")

</div>

i have a processing sketch that loads svgfiles with the loadShape function from a folder within the source folder called graphics. when i build it as an executable app, i have to remove all the loadShape calls and refere…

---

## [Is my fractal optimized? Could it animate?](https://discourse.processing.org/t/is-my-fractal-optimized-could-it-animate/28845)

<div class="topic-metadata">

**Author:** [@rodsn](https://discourse.processing.org/u/rodsn)\
**Replies:** 3\
**Last updated:** [March 26, 2021, 12:44pm UTC](https://discourse.processing.org/t/is-my-fractal-optimized-could-it-animate/28845 "2021-03-26T12:44:33Z")

</div>

Hello everyone, hope you are doing fine. I am trying to implement a recursive system. The recursion is working properly, my questions are: is this optimal? Am i doing this in a efficient way? Can i implement some kind o…

---

## [Random question with song](https://discourse.processing.org/t/random-question-with-song/28853)

<div class="topic-metadata">

**Author:** [@Ellen](https://discourse.processing.org/u/Ellen)\
**Replies:** 1\
**Last updated:** [March 26, 2021, 9:29am UTC](https://discourse.processing.org/t/random-question-with-song/28853 "2021-03-26T09:29:24Z")

</div>

I’m stuck that I cannot make a song match a random question. Can anybody help, please? import processing.sound.\*; SoundFile file; String\[\] Texts = { "Question A", "Question B", "Question C", "Question D", …

---

## [I can't make sound effect on processing (Quiz)](https://discourse.processing.org/t/i-cant-make-sound-effect-on-processing-quiz/28848)

<div class="topic-metadata">

**Author:** [@Ellen](https://discourse.processing.org/u/Ellen)\
**Replies:** 16\
**Last updated:** [March 26, 2021, 9:15am UTC](https://discourse.processing.org/t/i-cant-make-sound-effect-on-processing-quiz/28848 "2021-03-26T09:15:20Z")

</div>

I want to make a function for. if I click the correct answer, that will make a sound I tried it, but it isn’t working I don’t know what is wrong… can anybody help me? import processing.sound.\*; SoundFile file; Stri…

---

## [Anyone can help me with scaling?](https://discourse.processing.org/t/anyone-can-help-me-with-scaling/28673)

<div class="topic-metadata">

**Author:** [@olia](https://discourse.processing.org/u/olia)\
**Replies:** 3\
**Last updated:** [March 25, 2021, 10:23pm UTC](https://discourse.processing.org/t/anyone-can-help-me-with-scaling/28673 "2021-03-25T22:23:38Z")

</div>

Sorry my eng not that good. So i created pattern with my own function and than used loop (i think u dont understand so just try my code) float a=0.0; int x = -20; int y = -20; int rad = 50; int dod = 50; void setup() {…

---

## [Get random letters and put into a string](https://discourse.processing.org/t/get-random-letters-and-put-into-a-string/28585)

<div class="topic-metadata">

**Author:** [@resboy2445](https://discourse.processing.org/u/resboy2445)\
**Replies:** 9\
**Last updated:** [March 25, 2021, 10:14am UTC](https://discourse.processing.org/t/get-random-letters-and-put-into-a-string/28585 "2021-03-25T10:14:48Z")

</div>

how do we generate random letters in processing, and store them in a string? do we use something like the random() function and the ascii number? i’m not even sure how to do that.

---

## [Moving multiple components left to right](https://discourse.processing.org/t/moving-multiple-components-left-to-right/28825)

<div class="topic-metadata">

**Author:** [@hwahwa](https://discourse.processing.org/u/hwahwa)\
**Replies:** 1\
**Last updated:** [March 25, 2021, 9:44am UTC](https://discourse.processing.org/t/moving-multiple-components-left-to-right/28825 "2021-03-25T09:44:57Z")

</div>

Hello, I’ve written some code that moves a rectangle and triangle (an arrow) to move left to right but I’m positive that there is a cleaner and more efficient way to do this. My code for this was a bit unorganised and I …

---

## [Making a line break instruction in a string work even though it's fetched from a csv file](https://discourse.processing.org/t/making-a-line-break-instruction-in-a-string-work-even-though-its-fetched-from-a-csv-file/28812)

<div class="topic-metadata">

**Author:** [@Bobolink](https://discourse.processing.org/u/Bobolink)\
**Replies:** 5\
**Last updated:** [March 25, 2021, 8:23am UTC](https://discourse.processing.org/t/making-a-line-break-instruction-in-a-string-work-even-though-its-fetched-from-a-csv-file/28812 "2021-03-25T08:23:44Z")

</div>

I’m trying to print a string with a line break in it, where this string is fetched from a csv file. When running the code below, typing in the string with the line break myself, everything works as expected: import pro…

---

## [Sprite code not working, please help](https://discourse.processing.org/t/sprite-code-not-working-please-help/28817)

<div class="topic-metadata">

**Author:** [@DrAwesomeSauce2000](https://discourse.processing.org/u/DrAwesomeSauce2000)\
**Replies:** 0\
**Last updated:** [March 25, 2021, 1:39am UTC](https://discourse.processing.org/t/sprite-code-not-working-please-help/28817 "2021-03-25T01:39:04Z")

</div>

import sprites.utils.; import sprites.maths.; import sprites.\*; Sprite sonic; StopWatch sw= new StopWatch (); void setup() { size(1280, 720); sonic = new Sprite (this, “pngjoy.com\_sonic-sprite-modern-sonic-advance…

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

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