# Coding Questions

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

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

**Page:** 68

---

## [Animated Mosaic in Processing](https://discourse.processing.org/t/animated-mosaic-in-processing/26609)

<div class="topic-metadata">

**Author:** [@Jboon](https://discourse.processing.org/u/Jboon)\
**Replies:** 1\
**Last updated:** [December 31, 2020, 1:05pm UTC](https://discourse.processing.org/t/animated-mosaic-in-processing/26609 "2020-12-31T13:05:52Z")

</div>

So I’ve watched Dan Shiffman’s lesson on the mosaic and I’m pasting here the code from the lesson and I could understand it (processing newbie here!). What I’d like to do and would appreciate some help with is animating …

---

## [Move Map depending on character position](https://discourse.processing.org/t/move-map-depending-on-character-position/26610)

<div class="topic-metadata">

**Author:** [@corken](https://discourse.processing.org/u/corken)\
**Replies:** 2\
**Last updated:** [December 30, 2020, 10:24pm UTC](https://discourse.processing.org/t/move-map-depending-on-character-position/26610 "2020-12-30T22:24:35Z")

</div>

Hello I want to move my tiledMap depending on my characters position. But when I simply set the maps position to the characters position the collision detection goes wild. Any solutions?’ What I tried was map.draw(posi…

---

## [Turning characters of a String into rectangles](https://discourse.processing.org/t/turning-characters-of-a-string-into-rectangles/26580)

<div class="topic-metadata">

**Author:** [@Sophie](https://discourse.processing.org/u/Sophie)\
**Replies:** 11\
**Last updated:** [December 30, 2020, 2:04pm UTC](https://discourse.processing.org/t/turning-characters-of-a-string-into-rectangles/26580 "2020-12-30T14:04:42Z")

</div>

Hello, I’m having trouble with my code. Basically, I have a text and want every letter to be replaced by a rectangle matching the letter with different colours in a row next to each other. It might seem stupid, but the…

---

## [Sketch is running at low framerate (3fps) i don't know why](https://discourse.processing.org/t/sketch-is-running-at-low-framerate-3fps-i-dont-know-why/26607)

<div class="topic-metadata">

**Author:** [@WillG](https://discourse.processing.org/u/WillG)\
**Replies:** 2\
**Last updated:** [December 30, 2020, 1:54pm UTC](https://discourse.processing.org/t/sketch-is-running-at-low-framerate-3fps-i-dont-know-why/26607 "2020-12-30T13:54:25Z")

</div>

Hello! I’m a student and i have to create a sketch with bus point and density at these bus points. In fact all my sketch is working but at a very low framerate even if i put frameRate(30 or 60). Can someone help me ple…

---

## [Beginner Q: Creating Grids and Interacting With Them](https://discourse.processing.org/t/beginner-q-creating-grids-and-interacting-with-them/26588)

<div class="topic-metadata">

**Author:** [@alenmartel](https://discourse.processing.org/u/alenmartel)\
**Replies:** 8\
**Last updated:** [December 29, 2020, 4:13pm UTC](https://discourse.processing.org/t/beginner-q-creating-grids-and-interacting-with-them/26588 "2020-12-29T16:13:23Z")

</div>

Hi all - I’m brand new to Processing (and coding). I’ve done a few hours of coding now (learning via the Learning Processing book by Daniel Shifman) and have taken myself to task with the homework as well as creating a l…

---

## [Using variables with existing variables](https://discourse.processing.org/t/using-variables-with-existing-variables/26584)

<div class="topic-metadata">

**Author:** [@felix.west](https://discourse.processing.org/u/felix.west)\
**Replies:** 3\
**Last updated:** [December 29, 2020, 3:59pm UTC](https://discourse.processing.org/t/using-variables-with-existing-variables/26584 "2020-12-29T15:59:35Z")

</div>

Hi, I’d like to use a variable for an ellipse using another variable already written above. ex: int diameter = 50 int positionX = 200 int positionY = 200 –\> int ellipse1= ellipse(positionX, positionY, dia, dia) So…

---

## [How to change the equation into a code in an nth pendulum?](https://discourse.processing.org/t/how-to-change-the-equation-into-a-code-in-an-nth-pendulum/26558)

<div class="topic-metadata">

**Author:** [@Rafsing](https://discourse.processing.org/u/Rafsing)\
**Replies:** 5\
**Last updated:** [December 29, 2020, 12:28pm UTC](https://discourse.processing.org/t/how-to-change-the-equation-into-a-code-in-an-nth-pendulum/26558 "2020-12-29T12:28:12Z")

</div>

I want to simulate the nth level pendulum (double, triple and so on). I found the equations for the acceleration of the nth pendulum on this page: https://www.researchgate.net/publication/336868500\_Equations\_of\_Motion\_Fo…

---

## [Own programming language: How nested for-loop?](https://discourse.processing.org/t/own-programming-language-how-nested-for-loop/26396)

<div class="topic-metadata">

**Author:** [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Replies:** 3\
**Last updated:** [December 26, 2020, 11:20am UTC](https://discourse.processing.org/t/own-programming-language-how-nested-for-loop/26396 "2020-12-26T11:20:57Z")

</div>

Hello all, I am doing my own programming language at the moment. An interpreter language. When a for-loop is, not so difficult. I have the start line and he jumps x-times back to the start line ( “{” ) from the end li…

---

## [Drawing polygons with common side](https://discourse.processing.org/t/drawing-polygons-with-common-side/26550)

<div class="topic-metadata">

**Author:** [@ssdesign](https://discourse.processing.org/u/ssdesign)\
**Replies:** 5\
**Last updated:** [December 28, 2020, 7:27pm UTC](https://discourse.processing.org/t/drawing-polygons-with-common-side/26550 "2020-12-28T19:27:24Z")

</div>

I am trying to create multiple polygons with common sides as shown in this video Somehow, if I follow the principle of first drawing a hexagon and then dividing the radius into 6 parts to get the offset dim…

---

## [Custom svg files don't render?](https://discourse.processing.org/t/custom-svg-files-dont-render/26434)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 7\
**Last updated:** [December 28, 2020, 3:14pm UTC](https://discourse.processing.org/t/custom-svg-files-dont-render/26434 "2020-12-28T15:14:09Z")

</div>

so i’m just testing out how processing renders svg files and for some reason it will only work with test ones i’ve downloaded from the internet, and the custom ones i exported from inkscape will compile but don’t show up…

---

## [Custom svg files don't render](https://discourse.processing.org/t/custom-svg-files-dont-render/26480)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 3\
**Last updated:** [December 28, 2020, 3:13pm UTC](https://discourse.processing.org/t/custom-svg-files-dont-render/26480 "2020-12-28T15:13:21Z")

</div>

made a post about this a couple days ago but i couldn’t get the actual data past the spam filter so i’m trying again. i can’t get any custom made svgs to render in processing. test ones i download from the internet work …

---

## [I am making a project where the ball follows when i click the mouse, but that is not happening. Can anyone help?](https://discourse.processing.org/t/i-am-making-a-project-where-the-ball-follows-when-i-click-the-mouse-but-that-is-not-happening-can-anyone-help/26352)

<div class="topic-metadata">

**Author:** [@880597](https://discourse.processing.org/u/880597)\
**Replies:** 3\
**Last updated:** [December 27, 2020, 11:17pm UTC](https://discourse.processing.org/t/i-am-making-a-project-where-the-ball-follows-when-i-click-the-mouse-but-that-is-not-happening-can-anyone-help/26352 "2020-12-27T23:17:41Z")

</div>

I do not know how to fix the blue color only in the box, also I am trying to use mouse clicked, so that when the mouse is clicked the ball follows it and returns back to the rectangle, but that is not happening. Can some…

---

## [Finding a fixpoint for the corner of a moveable camera in P3D Need urgent help](https://discourse.processing.org/t/finding-a-fixpoint-for-the-corner-of-a-moveable-camera-in-p3d-need-urgent-help/26482)

<div class="topic-metadata">

**Author:** [@SailorToei](https://discourse.processing.org/u/SailorToei)\
**Replies:** 13\
**Last updated:** [December 27, 2020, 2:20pm UTC](https://discourse.processing.org/t/finding-a-fixpoint-for-the-corner-of-a-moveable-camera-in-p3d-need-urgent-help/26482 "2020-12-27T14:20:34Z")

</div>

Hello everybody, currently I am working on a game in 3D where the camera moves when there’s deviation of mouseX from the middle of the screen. It’s turning around the character, and when c is pressed, it switches to ego-…

---

## [Nth degree pendulum](https://discourse.processing.org/t/nth-degree-pendulum/26411)

<div class="topic-metadata">

**Author:** [@Rafsing](https://discourse.processing.org/u/Rafsing)\
**Replies:** 12\
**Last updated:** [December 27, 2020, 10:24am UTC](https://discourse.processing.org/t/nth-degree-pendulum/26411 "2020-12-27T10:24:48Z")

</div>

I made an nth degree pendulum, but it moves very fast. This means there is something wrong with the equations of motion: for (int i = 1; i \<circles.size(); i++) { circles.get(i).acceleration.set(0, (-g / lenghts…

---

## [Generate random not overlapping triangles](https://discourse.processing.org/t/generate-random-not-overlapping-triangles/25875)

<div class="topic-metadata">

**Author:** [@nktlst](https://discourse.processing.org/u/nktlst)\
**Replies:** 9\
**Last updated:** [December 26, 2020, 7:24pm UTC](https://discourse.processing.org/t/generate-random-not-overlapping-triangles/25875 "2020-12-26T19:24:09Z")

</div>

Hi! I trying to understand how this task can be solved: I need generate number of triangles (any size) in any random place on sketch, but i need them not overlapping with each other and may be with constant distance fro…

---

## [Line-Line intersection for y=mx+c](https://discourse.processing.org/t/line-line-intersection-for-y-mx-c/26484)

<div class="topic-metadata">

**Author:** [@dave307](https://discourse.processing.org/u/dave307)\
**Replies:** 4\
**Last updated:** [December 25, 2020, 2:51pm UTC](https://discourse.processing.org/t/line-line-intersection-for-y-mx-c/26484 "2020-12-25T14:51:48Z")

</div>

I was wondering how to make a function that you give it two line equations in the form y=mx+c you pass it the gradient and y-intercept of both. then it returns a vector which is the point in which the two given lines w…

---

## [Live updating counter (need to use strings or array?)](https://discourse.processing.org/t/live-updating-counter-need-to-use-strings-or-array/26472)

<div class="topic-metadata">

**Author:** [@codestruggles](https://discourse.processing.org/u/codestruggles)\
**Replies:** 11\
**Last updated:** [December 25, 2020, 5:50am UTC](https://discourse.processing.org/t/live-updating-counter-need-to-use-strings-or-array/26472 "2020-12-25T05:50:24Z")

</div>

Hello, I’m having some trouble figuring out how to make a simple number counter that is connected to events in airtable. Basically, i have a table which tracks at what time an event occured and i would like to have a c…

---

## [3D Rotation Question](https://discourse.processing.org/t/3d-rotation-question/26438)

<div class="topic-metadata">

**Author:** [@RFullum](https://discourse.processing.org/u/RFullum)\
**Replies:** 8\
**Last updated:** [December 24, 2020, 12:05am UTC](https://discourse.processing.org/t/3d-rotation-question/26438 "2020-12-24T00:05:15Z")

</div>

Hey all, I used the Flocking example as a starting point, and made a flocking sketch that works in 3D, with multiple flocks being influenced by FFT band amplitudes. The problem i’m running into is getting each boid to r…

---

## [Beginner's problem with while() loop](https://discourse.processing.org/t/beginners-problem-with-while-loop/26469)

<div class="topic-metadata">

**Author:** [@nazazaku](https://discourse.processing.org/u/nazazaku)\
**Replies:** 5\
**Last updated:** [December 23, 2020, 9:29pm UTC](https://discourse.processing.org/t/beginners-problem-with-while-loop/26469 "2020-12-23T21:29:35Z")

</div>

I just want to do a simple grid with circles, but it just doesn’t work. The circles don’t complete the grid and stop at a random point. The circles stop at a different point each time I run the program. Pls help. I’m us…

---

## [Random movement](https://discourse.processing.org/t/random-movement/26464)

<div class="topic-metadata">

**Author:** [@hullah](https://discourse.processing.org/u/hullah)\
**Replies:** 6\
**Last updated:** [December 23, 2020, 4:12pm UTC](https://discourse.processing.org/t/random-movement/26464 "2020-12-23T16:12:56Z")

</div>

hey folks, I would like to code a game in which you see the ocean from top view (so far no problems) . On the ocean there should be a boat (imported png) that changes direction inside the window randomly. Which function…

---

## [Dessiner plusieurs polygones et ils doivent formés une art polynomial](https://discourse.processing.org/t/dessiner-plusieurs-polygones-et-ils-doivent-formes-une-art-polynomial/26456)

<div class="topic-metadata">

**Author:** [@nina](https://discourse.processing.org/u/nina)\
**Replies:** 4\
**Last updated:** [December 23, 2020, 1:34pm UTC](https://discourse.processing.org/t/dessiner-plusieurs-polygones-et-ils-doivent-formes-une-art-polynomial/26456 "2020-12-23T13:34:22Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Bonjour, J’ai fait un programme pour qu’il me fasse une translation si le déplacement était égale à vingt . Puis, j’ai utiliser une boucle For …

---

## [How do I export groups of objects in SVG and find them correctly in Inkscape?](https://discourse.processing.org/t/how-do-i-export-groups-of-objects-in-svg-and-find-them-correctly-in-inkscape/16556)

<div class="topic-metadata">

**Author:** [@411x](https://discourse.processing.org/u/411x)\
**Replies:** 8\
**Last updated:** [December 23, 2020, 12:42pm UTC](https://discourse.processing.org/t/how-do-i-export-groups-of-objects-in-svg-and-find-them-correctly-in-inkscape/16556 "2020-12-23T12:42:04Z")

</div>

Hello, I have several shapes and I would like to assign a color to them, so that I can then print them layer by layer. So I would like to assign “objects” to a (color) group that I could then split into layers in inksc…

---

## [Use launch() but have the app minimized?](https://discourse.processing.org/t/use-launch-but-have-the-app-minimized/26452)

<div class="topic-metadata">

**Author:** [@CaseyJ](https://discourse.processing.org/u/CaseyJ)\
**Replies:** 4\
**Last updated:** [December 23, 2020, 12:11am UTC](https://discourse.processing.org/t/use-launch-but-have-the-app-minimized/26452 "2020-12-23T00:11:49Z")

</div>

Is there anyway to use launch() but have the app be minimized when it loads so it doesn’t cover the Processing sketch?

---

## [Default folder when using selectFolder()?](https://discourse.processing.org/t/default-folder-when-using-selectfolder/26289)

<div class="topic-metadata">

**Author:** [@CaseyJ](https://discourse.processing.org/u/CaseyJ)\
**Replies:** 3\
**Last updated:** [December 22, 2020, 7:49pm UTC](https://discourse.processing.org/t/default-folder-when-using-selectfolder/26289 "2020-12-22T19:49:48Z")

</div>

I am new to the selectFolder() game but am loving it! I read in the documentation that there are a few arguments (correct word?) that allow for other options when using this function. I would like to ideally provided a…

---

## [Help, code expecting EOF, found '}'](https://discourse.processing.org/t/help-code-expecting-eof-found/26444)

<div class="topic-metadata">

**Author:** [@Dialias](https://discourse.processing.org/u/Dialias)\
**Replies:** 6\
**Last updated:** [December 22, 2020, 5:41pm UTC](https://discourse.processing.org/t/help-code-expecting-eof-found/26444 "2020-12-22T17:41:23Z")

</div>

int money; PImage pic1; PImage pic2; int rx1 = 250; int ry1 = 200; int rwidth1 = 280; int rheight1 = 140; int rx2 = 600; int ry2 = 600; int rwidth2 = 780; int rheight2 = 780; void setup() { size(800, 600); m…

---

## [Using sin() function](https://discourse.processing.org/t/using-sin-function/26293)

<div class="topic-metadata">

**Author:** [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)\
**Replies:** 5\
**Last updated:** [December 22, 2020, 9:03am UTC](https://discourse.processing.org/t/using-sin-function/26293 "2020-12-22T09:03:19Z")

</div>

Hi, everyone ! I want to ask, when using function sin(), how to control it ? I mean, when sin() reaches to -1 I want to say stop and move after some time. For example, see this sketch . I appreciate any help, thanks ! …

---

## [Write code smarter and better](https://discourse.processing.org/t/write-code-smarter-and-better/26213)

<div class="topic-metadata">

**Author:** [@vestergaard12](https://discourse.processing.org/u/vestergaard12)\
**Replies:** 15\
**Last updated:** [December 22, 2020, 7:33am UTC](https://discourse.processing.org/t/write-code-smarter-and-better/26213 "2020-12-22T07:33:53Z")

</div>

Hello Processing Foundation How would you compromize this code, for example into a for-loop or one simple function? if (key == c\[n\]) { n++; text1\[0\] = text1\[0\].substring(0, n-1) + '-' + text1\[0\].substri…

---

## [Hello i made some quiz and i can only change 2 page if anyone can show me how can ı reset the page](https://discourse.processing.org/t/hello-i-made-some-quiz-and-i-can-only-change-2-page-if-anyone-can-show-me-how-can-i-reset-the-page/26424)

<div class="topic-metadata">

**Author:** [@clay21](https://discourse.processing.org/u/clay21)\
**Replies:** 11\
**Last updated:** [December 21, 2020, 9:39pm UTC](https://discourse.processing.org/t/hello-i-made-some-quiz-and-i-can-only-change-2-page-if-anyone-can-show-me-how-can-i-reset-the-page/26424 "2020-12-21T21:39:27Z")

</div>

int page=0; void setup(){ size(800,600); page+=1; } void draw(){ switch(page){ case 1:drawPage1();break; case 2:drawPage2();break; case 3:drawPage3();break; case 4:drawPage4(); break; default:break; } } vo…

---

## [Creating a loading animation](https://discourse.processing.org/t/creating-a-loading-animation/26422)

<div class="topic-metadata">

**Author:** [@edumanilha](https://discourse.processing.org/u/edumanilha)\
**Replies:** 8\
**Last updated:** [December 21, 2020, 8:13pm UTC](https://discourse.processing.org/t/creating-a-loading-animation/26422 "2020-12-21T20:13:18Z")

</div>

I need help to make a loading bar…When i click the mouse over the button the message come with 100% and filled bar…How can I make it charge a percent after X seconds? And how I can go back to the buttons screens after …

---

## [Need help with a simple animation](https://discourse.processing.org/t/need-help-with-a-simple-animation/26409)

<div class="topic-metadata">

**Author:** [@trelosti](https://discourse.processing.org/u/trelosti)\
**Replies:** 3\
**Last updated:** [December 21, 2020, 7:55am UTC](https://discourse.processing.org/t/need-help-with-a-simple-animation/26409 "2020-12-21T07:55:13Z")

</div>

Here is what I want to do: create a chain of circles (number of circles if defined by user input) that must zigzag and change direction of movement when reaching a boundaries of the screen. But I have problems with “sna…

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

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