# Coding Questions

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

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

**Page:** 64

---

## [Bouncing Ball Velocity Problem](https://discourse.processing.org/t/bouncing-ball-velocity-problem/27620)

<div class="topic-metadata">

**Author:** [@Akiraishido](https://discourse.processing.org/u/Akiraishido)\
**Replies:** 2\
**Last updated:** [February 6, 2021, 11:51am UTC](https://discourse.processing.org/t/bouncing-ball-velocity-problem/27620 "2021-02-06T11:51:10Z")

</div>

I’m new to Processing (I programmed in C# before) and I tried to make a bouncing ball with vectors but when I run the program, the ball goes a little bit to the right. This is my code: Ball b; void setup() { size(12…

---

## [Combining Multiple SVG Elements](https://discourse.processing.org/t/combining-multiple-svg-elements/27615)

<div class="topic-metadata">

**Author:** [@BeneBeats](https://discourse.processing.org/u/BeneBeats)\
**Replies:** 0\
**Last updated:** [February 5, 2021, 11:59pm UTC](https://discourse.processing.org/t/combining-multiple-svg-elements/27615 "2021-02-05T23:59:59Z")

</div>

I’m creating SVGs in Processing for pen plotting. Everything is going great until I start plotting. The test Truchet tiles I’ve created end up as separate arcs. I’ll attach some example pictures. The output SVG looks so…

---

## [Loop gif n number of times?](https://discourse.processing.org/t/loop-gif-n-number-of-times/27449)

<div class="topic-metadata">

**Author:** [@mweinberg](https://discourse.processing.org/u/mweinberg)\
**Replies:** 2\
**Last updated:** [February 5, 2021, 12:35am UTC](https://discourse.processing.org/t/loop-gif-n-number-of-times/27449 "2021-02-05T00:35:16Z")

</div>

Hi everyone! I’m trying to figure out how to loop a gif a specific number of times, after which it stops at the first frame. I know that I can stop and pause a gif with play() (https://p5js.org/reference/#/p5.Image/play)…

---

## [Scaled Mapping a Value](https://discourse.processing.org/t/scaled-mapping-a-value/27564)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 9\
**Last updated:** [February 4, 2021, 6:39am UTC](https://discourse.processing.org/t/scaled-mapping-a-value/27564 "2021-02-04T06:39:00Z")

</div>

Hello again, I have this value from -10 to 10 that I want to map to -725 to 725. However, the mapped value should be -600 when the value is -5, or the value is -300 when the mapped value is -2. I would like for this to w…

---

## [Extract the rule of the sequence](https://discourse.processing.org/t/extract-the-rule-of-the-sequence/27547)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 3\
**Last updated:** [February 2, 2021, 6:24pm UTC](https://discourse.processing.org/t/extract-the-rule-of-the-sequence/27547 "2021-02-02T18:24:37Z")

</div>

Hi! I want to create a program, that given input “1,2,3,4,1,2,3,4,1,2,3,4”, returns 1,2,3,4. It extracts the rule of the sequence. Here is the code to get the sequence ( \[Fibonacci number\] % m) ArrayList\<Integer\> fib…

---

## [Create a game (point and click)](https://discourse.processing.org/t/create-a-game-point-and-click/27530)

<div class="topic-metadata">

**Author:** [@Torikusu](https://discourse.processing.org/u/Torikusu)\
**Replies:** 7\
**Last updated:** [February 2, 2021, 1:20pm UTC](https://discourse.processing.org/t/create-a-game-point-and-click/27530 "2021-02-02T13:20:40Z")

</div>

Hello, I am a beginner in processing I would like to create a clicker on processing, to clarify, I would like a square or circle to appear and disappear when we click on it or if we have not clicked after a certain time …

---

## [Sawtooth wave. Algorithm](https://discourse.processing.org/t/sawtooth-wave-algorithm/27433)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 2\
**Last updated:** [February 1, 2021, 12:02pm UTC](https://discourse.processing.org/t/sawtooth-wave-algorithm/27433 "2021-02-01T12:02:34Z")

</div>

Hello Misters and misses, I need to control a sawtooth wave, like explained wikipedia https://en.wikipedia.org/wiki/Sawtooth\_wave This a kind of triangular wave in wikipedia. You 'll find it here: algorithm in JavaScri…

---

## [Drawing Tool with Processing](https://discourse.processing.org/t/drawing-tool-with-processing/27431)

<div class="topic-metadata">

**Author:** [@serg](https://discourse.processing.org/u/serg)\
**Replies:** 2\
**Last updated:** [February 1, 2021, 9:53am UTC](https://discourse.processing.org/t/drawing-tool-with-processing/27431 "2021-02-01T09:53:27Z")

</div>

Hi everyone! I am trying to create a little drawing tool with processing. The final drawing should be exportable as a .svg file – so i thought this to be pretty easy… but actually it isnt… I put the background function …

---

## [Drawing lines between two selected planets](https://discourse.processing.org/t/drawing-lines-between-two-selected-planets/27502)

<div class="topic-metadata">

**Author:** [@borromini](https://discourse.processing.org/u/borromini)\
**Replies:** 3\
**Last updated:** [February 1, 2021, 6:44am UTC](https://discourse.processing.org/t/drawing-lines-between-two-selected-planets/27502 "2021-02-01T06:44:01Z")

</div>

Hi everyone, I have a source code which has moving planets on an orbit. I would like to draw lines between two of them (like draw lines between Earth and Jupiter). Here is an example I found on Youtube: https://www.youtu…

---

## [How to make a simple bar?](https://discourse.processing.org/t/how-to-make-a-simple-bar/27500)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 3\
**Last updated:** [January 31, 2021, 8:14pm UTC](https://discourse.processing.org/t/how-to-make-a-simple-bar/27500 "2021-01-31T20:14:51Z")

</div>

I want to make a simple bar that fills up when the value is positive, and the bar goes down when the value is negative. The only thing is, that when the value is at 0 it should be half filled. I have tried implenting thi…

---

## [How can I turn an image in PNG or SVG format into a ring shape?](https://discourse.processing.org/t/how-can-i-turn-an-image-in-png-or-svg-format-into-a-ring-shape/27479)

<div class="topic-metadata">

**Author:** [@Violet](https://discourse.processing.org/u/Violet)\
**Replies:** 11\
**Last updated:** [January 31, 2021, 10:59am UTC](https://discourse.processing.org/t/how-can-i-turn-an-image-in-png-or-svg-format-into-a-ring-shape/27479 "2021-01-31T10:59:57Z")

</div>

I want to use processing to complete the following effect, which is to copy a picture and deform it to make it ring.But I don’t know how to turn the image into a fan shape. The general method of operation should be as…

---

## [getChild() not displaying anything](https://discourse.processing.org/t/getchild-not-displaying-anything/25858)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 7\
**Last updated:** [January 31, 2021, 10:38am UTC](https://discourse.processing.org/t/getchild-not-displaying-anything/25858 "2021-01-31T10:38:28Z")

</div>

import processing.svg.\*; PShape s; float reso, dLen; int counter = 0; void setup() { size(800, 800); reso = width; dLen =sqrt(pow(reso, 2)+pow(reso, 2)); shapeMode(CENTER); beginRecord(SVG, "DL-"+nf(counter, 3…

---

## [Processing and JOGL - How are concave polygons and borders rendered?](https://discourse.processing.org/t/processing-and-jogl-how-are-concave-polygons-and-borders-rendered/27485)

<div class="topic-metadata">

**Author:** [@r.jaoui](https://discourse.processing.org/u/r.jaoui)\
**Replies:** 1\
**Last updated:** [January 30, 2021, 6:42pm UTC](https://discourse.processing.org/t/processing-and-jogl-how-are-concave-polygons-and-borders-rendered/27485 "2021-01-30T18:42:53Z")

</div>

Hello ! First of all, sorry for this post that is not really about Processing coding but about how processing itself is coded, and the JOGL library. I’ve recently started working in OpenGL for a project, and I’m faced …

---

## [Condition and interruption problems for a newbie](https://discourse.processing.org/t/condition-and-interruption-problems-for-a-newbie/27467)

<div class="topic-metadata">

**Author:** [@freddukas](https://discourse.processing.org/u/freddukas)\
**Replies:** 4\
**Last updated:** [January 29, 2021, 8:24pm UTC](https://discourse.processing.org/t/condition-and-interruption-problems-for-a-newbie/27467 "2021-01-29T20:24:44Z")

</div>

Hello everyone thanks for the add.I’m totally newbie to Processing & I tried to create my first code who works as a magic trick. I have several conditions in my code in order to help me to guess a number within the seve…

---

## [Table print columnName as 1 row](https://discourse.processing.org/t/table-print-columnname-as-1-row/27465)

<div class="topic-metadata">

**Author:** [@ren](https://discourse.processing.org/u/ren)\
**Replies:** 1\
**Last updated:** [January 29, 2021, 5:14pm UTC](https://discourse.processing.org/t/table-print-columnname-as-1-row/27465 "2021-01-29T17:14:01Z")

</div>

How can I first print out on a single line all of my table’s column name of my table like this: X Y Z 8 15.99 Oxygen Table table; table = new Table(); table.addColumn("X"); tabl…

---

## [How can I test with a function whether another function is being executed?](https://discourse.processing.org/t/how-can-i-test-with-a-function-whether-another-function-is-being-executed/27460)

<div class="topic-metadata">

**Author:** [@Flolo](https://discourse.processing.org/u/Flolo)\
**Replies:** 1\
**Last updated:** [January 29, 2021, 4:47pm UTC](https://discourse.processing.org/t/how-can-i-test-with-a-function-whether-another-function-is-being-executed/27460 "2021-01-29T16:47:23Z")

</div>

Hi I want the mousePressed () function to be executed whenever the mousePressed function is executed by the parent without having to write it into the function of the parent … I hope you can help me :slight\_smile: clas…

---

## [Pls help me with my homework](https://discourse.processing.org/t/pls-help-me-with-my-homework/27439)

<div class="topic-metadata">

**Author:** [@campervi](https://discourse.processing.org/u/campervi)\
**Replies:** 2\
**Last updated:** [January 29, 2021, 9:40am UTC](https://discourse.processing.org/t/pls-help-me-with-my-homework/27439 "2021-01-29T09:40:34Z")

</div>

Please help me with my homework. No.1 -Size 500 x 500 -Background: White -Rectangle start: x = 10, y = 30 -Rectangle size 40 horizontal and 30 vertical -Use width / height variables -Color: Make gradiation occur I…

---

## [Identify / Understand a Function in a Code](https://discourse.processing.org/t/identify-understand-a-function-in-a-code/27450)

<div class="topic-metadata">

**Author:** [@maneschka](https://discourse.processing.org/u/maneschka)\
**Replies:** 2\
**Last updated:** [January 29, 2021, 2:14am UTC](https://discourse.processing.org/t/identify-understand-a-function-in-a-code/27450 "2021-01-29T02:14:17Z")

</div>

Hi! I found this code in OpenProcessing and I want to change some of its functions, I have been trying to understand the code but I simply cant. So, what I’m trying to do, is that instead of manipulating the mesh with t…

---

## [Adding a random value to each item in array?](https://discourse.processing.org/t/adding-a-random-value-to-each-item-in-array/27430)

<div class="topic-metadata">

**Author:** [@Marinus](https://discourse.processing.org/u/Marinus)\
**Replies:** 3\
**Last updated:** [January 29, 2021, 1:16am UTC](https://discourse.processing.org/t/adding-a-random-value-to-each-item-in-array/27430 "2021-01-29T01:16:57Z")

</div>

Hello, I am trying to achieve a loop that runs through an array with 120 values for sin and a second array that runs through 120 values for cos. Every time the loop runs I want to add a random number to the previous valu…

---

## [Sinusoidal wave made out of dots](https://discourse.processing.org/t/sinusoidal-wave-made-out-of-dots/27368)

<div class="topic-metadata">

**Author:** [@Pastaz](https://discourse.processing.org/u/Pastaz)\
**Replies:** 12\
**Last updated:** [January 28, 2021, 3:18pm UTC](https://discourse.processing.org/t/sinusoidal-wave-made-out-of-dots/27368 "2021-01-28T15:18:17Z")

</div>

Hello, I’m stuck on a code for an output of a sinusoidal wave made out of single dots, i’m looking for a solution without using vertexCurve(). Please have a look at the image below for a better explanation: …

---

## [Help with interfaces and abstract classes](https://discourse.processing.org/t/help-with-interfaces-and-abstract-classes/27424)

<div class="topic-metadata">

**Author:** [@EliTheIceMan](https://discourse.processing.org/u/EliTheIceMan)\
**Replies:** 1\
**Last updated:** [January 28, 2021, 7:50am UTC](https://discourse.processing.org/t/help-with-interfaces-and-abstract-classes/27424 "2021-01-28T07:50:29Z")

</div>

So I’m working on a program to control real world light fixtures. I have made a class for each type of light that encompasses all the traits of the fixture type and then an instance is created for each of the real word …

---

## [Creating 3D objects](https://discourse.processing.org/t/creating-3d-objects/27411)

<div class="topic-metadata">

**Author:** [@proc8888](https://discourse.processing.org/u/proc8888)\
**Replies:** 1\
**Last updated:** [January 27, 2021, 4:53pm UTC](https://discourse.processing.org/t/creating-3d-objects/27411 "2021-01-27T16:53:08Z")

</div>

I am currently coding some 3D shapes using P3D mode (with and without the use of void draw()). The aim is to create 3D file in format OBJ, which can be then used eg. for fabrication such as 3D printing. I have several …

---

## [Game of life not working](https://discourse.processing.org/t/game-of-life-not-working/27012)

<div class="topic-metadata">

**Author:** [@FrigittyFrog](https://discourse.processing.org/u/FrigittyFrog)\
**Replies:** 6\
**Last updated:** [January 27, 2021, 4:03pm UTC](https://discourse.processing.org/t/game-of-life-not-working/27012 "2021-01-27T16:03:25Z")

</div>

Can anyone tell me why my code is not working? There isn’t a syntax error, but everytime I run the code, the screen immeadiatelly turns white. I’m trying to create the game of life \[https://en.wikipedia.org/wiki/Conway’s…

---

## [Issues with Delaunay triangulation (Bowyer-Watson)](https://discourse.processing.org/t/issues-with-delaunay-triangulation-bowyer-watson/27255)

<div class="topic-metadata">

**Author:** [@Althos](https://discourse.processing.org/u/Althos)\
**Replies:** 3\
**Last updated:** [January 27, 2021, 1:56pm UTC](https://discourse.processing.org/t/issues-with-delaunay-triangulation-bowyer-watson/27255 "2021-01-27T13:56:17Z")

</div>

Hi, as the name says, I’m currently trying to code a simple Delaunay triangulation, using the Bowyer-Watson algorithm, I found great tutorials to help me along the way and my code is nearly working fine, except for one i…

---

## [Object &Pixel Collision detection](https://discourse.processing.org/t/object-pixel-collision-detection/27384)

<div class="topic-metadata">

**Author:** [@cicekselen](https://discourse.processing.org/u/cicekselen)\
**Replies:** 2\
**Last updated:** [January 27, 2021, 1:43pm UTC](https://discourse.processing.org/t/object-pixel-collision-detection/27384 "2021-01-27T13:43:01Z")

</div>

Hey, I am a real newbie in coding in processing and I need help for my hw. I am trying to develop an agent-based simulation in which, the agents move in a closed space with obstacles. For the obstacles I am trying to use…

---

## [Stroke Decrease isnt working](https://discourse.processing.org/t/stroke-decrease-isnt-working/27349)

<div class="topic-metadata">

**Author:** [@Prxt.3k](https://discourse.processing.org/u/Prxt.3k)\
**Replies:** 6\
**Last updated:** [January 25, 2021, 4:51pm UTC](https://discourse.processing.org/t/stroke-decrease-isnt-working/27349 "2021-01-25T16:51:38Z")

</div>

//Minim Library import ddf.minim.\*; import ddf.minim.analysis.\*; import ddf.minim.effects.\*; import ddf.minim.signals.\*; import ddf.minim.spi.\*; import ddf.minim.ugens.\*; //Global Variables \<--------------------------…

---

## [How to parse this string?](https://discourse.processing.org/t/how-to-parse-this-string/27362)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 3\
**Last updated:** [January 25, 2021, 2:53pm UTC](https://discourse.processing.org/t/how-to-parse-this-string/27362 "2021-01-25T14:53:36Z")

</div>

I have this string: "0000A000" How would I be able to group the zeros to get a string like this: 4A3

---

## [Effect not applying on a image in array](https://discourse.processing.org/t/effect-not-applying-on-a-image-in-array/27200)

<div class="topic-metadata">

**Author:** [@anarts\_3](https://discourse.processing.org/u/anarts_3)\
**Replies:** 2\
**Last updated:** [January 25, 2021, 9:56am UTC](https://discourse.processing.org/t/effect-not-applying-on-a-image-in-array/27200 "2021-01-25T09:56:33Z")

</div>

Hello everyone! I have this code that has a dot effect on the images and has code to change said image into the next one when the mouse is pressed. int numFrames = 18; // The number of frames in the animation int frame…

---

## [How to check if there is an image with the same file name?](https://discourse.processing.org/t/how-to-check-if-there-is-an-image-with-the-same-file-name/27336)

<div class="topic-metadata">

**Author:** [@Lukerfull](https://discourse.processing.org/u/Lukerfull)\
**Replies:** 6\
**Last updated:** [January 24, 2021, 8:44pm UTC](https://discourse.processing.org/t/how-to-check-if-there-is-an-image-with-the-same-file-name/27336 "2021-01-24T20:44:12Z")

</div>

I want to save images without overwriting them. This is my code: if (controlDown) { if (keyCode == 83) { PImage partialSave = get(0,0,1098,650); nimg++; partialSave.save("drawings/draw"+nimg+".…

---

## [Open close windows](https://discourse.processing.org/t/open-close-windows/27312)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 3\
**Last updated:** [January 24, 2021, 6:51pm UTC](https://discourse.processing.org/t/open-close-windows/27312 "2021-01-24T18:51:44Z")

</div>

hi is there away to call one window from other window ? void setup() { String\[\] args = {"TwoFrameTest"}; SecondApplet sa = new SecondApplet(); PApplet.runSketch(args, sa); } void settings() { size(300, 100);…

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

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