# Beginners

**URL:** https://discourse.processing.org/c/processing/processing-beginners/14.md?page=21

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

**Page:** 22

---

## [How to check whether value is in range](https://discourse.processing.org/t/how-to-check-whether-value-is-in-range/27680)

<div class="topic-metadata">

**Author:** [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Replies:** 2\
**Last updated:** [February 9, 2021, 3:42am UTC](https://discourse.processing.org/t/how-to-check-whether-value-is-in-range/27680 "2021-02-09T03:42:56Z")

</div>

I’d like to check whether a value is in a range and then return a color accordingly. This is the first of many if statements: if(range.between(0,100).contains(value)){ c = #1a1334; } else if(Range.between(101,200).co…

---

## [Looking for simple examples of A\* pathfinding algorithm](https://discourse.processing.org/t/looking-for-simple-examples-of-a-pathfinding-algorithm/27616)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 1\
**Last updated:** [February 6, 2021, 12:56am UTC](https://discourse.processing.org/t/looking-for-simple-examples-of-a-pathfinding-algorithm/27616 "2021-02-06T00:56:31Z")

</div>

Hi, as the title says I’m looking for a simple example of the A\* algorithm as shown in the following link down below: I have also looked at the example made by Peter Lager, however it was way to hard for so…

---

## [Problems with cursor()](https://discourse.processing.org/t/problems-with-cursor/27584)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 2\
**Last updated:** [February 6, 2021, 12:27am UTC](https://discourse.processing.org/t/problems-with-cursor/27584 "2021-02-06T00:27:30Z")

</div>

Hi, I have a little project and i am trying to change the normal cursor with an image and it works for a little while, however after 1 minute it stops working (the cursor just changes back to the arrow and won’t change a…

---

## [Noel you are a school](https://discourse.processing.org/t/noel-you-are-a-school/27601)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 0\
**Last updated:** [February 5, 2021, 10:53am UTC](https://discourse.processing.org/t/noel-you-are-a-school/27601 "2021-02-05T10:53:32Z")

</div>

noel You are a complete school person and deserve all the best You have a distinctive style of communicating information, and you add to it many simplifications to provide an excellent way to enter the mind I apprecia…

---

## [BOUNCING circle in radius](https://discourse.processing.org/t/bouncing-circle-in-radius/27535)

<div class="topic-metadata">

**Author:** [@Jimena](https://discourse.processing.org/u/Jimena)\
**Replies:** 3\
**Last updated:** [February 2, 2021, 1:18pm UTC](https://discourse.processing.org/t/bouncing-circle-in-radius/27535 "2021-02-02T13:18:41Z")

</div>

please format code with \</\> button \* homework policy \* asking questions The assignment is: Create a circle of radius r initially in the center of the screen, which moves with a certain speed velX and velY. Initiali…

---

## [How to create new map shapes for default PShapes Sphere box etc](https://discourse.processing.org/t/how-to-create-new-map-shapes-for-default-pshapes-sphere-box-etc/27386)

<div class="topic-metadata">

**Author:** [@kp443](https://discourse.processing.org/u/kp443)\
**Replies:** 1\
**Last updated:** [January 27, 2021, 2:11pm UTC](https://discourse.processing.org/t/how-to-create-new-map-shapes-for-default-pshapes-sphere-box-etc/27386 "2021-01-27T14:11:18Z")

</div>

Tryna create planar mapping xy for a sphere. How to change the default mapping? Some tutorial link?

---

## [How to split image into several ones (spirtes)](https://discourse.processing.org/t/how-to-split-image-into-several-ones-spirtes/27365)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 1\
**Last updated:** [January 25, 2021, 6:03pm UTC](https://discourse.processing.org/t/how-to-split-image-into-several-ones-spirtes/27365 "2021-01-25T18:03:12Z")

</div>

Hi! I am trying to make the basics for chess and I am interested how to turn an image into an array of sprites. CodePImage source = loadImage("chessPieces2.png"); println(source.width, source.height); size(12…

---

## [Find the second occurrence of an object in an array](https://discourse.processing.org/t/find-the-second-occurrence-of-an-object-in-an-array/27309)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 2\
**Last updated:** [January 23, 2021, 8:05pm UTC](https://discourse.processing.org/t/find-the-second-occurrence-of-an-object-in-an-array/27309 "2021-01-23T20:05:43Z")

</div>

Hello, I am doing a coding project but it requires me to get the second occurrence of an object in an array. int\[\]\[\] array = {1, 2, 3, 4}, {5, 6, 7, 8}, {1, 2, 3, 4}; How would you get the second occurrence of “1” in …

---

## [How to pull an image from a website](https://discourse.processing.org/t/how-to-pull-an-image-from-a-website/27285)

<div class="topic-metadata">

**Author:** [@skypickle](https://discourse.processing.org/u/skypickle)\
**Replies:** 3\
**Last updated:** [January 22, 2021, 5:25pm UTC](https://discourse.processing.org/t/how-to-pull-an-image-from-a-website/27285 "2021-01-22T17:25:15Z")

</div>

I want to use an image from a website as the basis for an interactive artwork. For example, this page “https://www.google.de/images/branding/googlelogo/2x/googlelogo\_color\_272x92dp.png” is a google logo. This script j…

---

## [Where do these methods... live?](https://discourse.processing.org/t/where-do-these-methods-live/27286)

<div class="topic-metadata">

**Author:** [@yoHill](https://discourse.processing.org/u/yoHill)\
**Replies:** 2\
**Last updated:** [January 22, 2021, 2:31pm UTC](https://discourse.processing.org/t/where-do-these-methods-live/27286 "2021-01-22T14:31:09Z")

</div>

Hi, I have a question that may be really stupid but I just can’t quite wrap my head around what’s happening here. When using methods like void draw() or void mousePressed()… are these part of an interface somewhere? I …

---

## [Issues with a simple pathfinder](https://discourse.processing.org/t/issues-with-a-simple-pathfinder/27265)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 0\
**Last updated:** [January 21, 2021, 1:53pm UTC](https://discourse.processing.org/t/issues-with-a-simple-pathfinder/27265 "2021-01-21T13:53:57Z")

</div>

Hi! I decided to remake a simple pathfinder algorithm (every “found” slot tries to find slots adjacent to itself that have not been found and are not “blocked” (it is meant to be used as a wall) The issue is the path ge…

---

## [Generative 3D Shapes](https://discourse.processing.org/t/generative-3d-shapes/27213)

<div class="topic-metadata">

**Author:** [@maneschka](https://discourse.processing.org/u/maneschka)\
**Replies:** 1\
**Last updated:** [January 20, 2021, 8:29am UTC](https://discourse.processing.org/t/generative-3d-shapes/27213 "2021-01-20T08:29:51Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi! Does somebody have a cool tutorial for learning how to do 3D Generative Shapes? Thanks!

---

## [Drawing order of Objects in an Arraylist](https://discourse.processing.org/t/drawing-order-of-objects-in-an-arraylist/27160)

<div class="topic-metadata">

**Author:** [@Gine6g](https://discourse.processing.org/u/Gine6g)\
**Replies:** 21\
**Last updated:** [January 19, 2021, 9:05pm UTC](https://discourse.processing.org/t/drawing-order-of-objects-in-an-arraylist/27160 "2021-01-19T21:05:41Z")

</div>

I didnt knew how to name this. But I got a class with multiple other classes that inherit from the main one. Now when I clicking I can add one of the Objects to the Sketch and all the Objects are held withing an Arrayli…

---

## [How to enter unlimited parameters info a function](https://discourse.processing.org/t/how-to-enter-unlimited-parameters-info-a-function/27207)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [January 19, 2021, 9:27pm UTC](https://discourse.processing.org/t/how-to-enter-unlimited-parameters-info-a-function/27207 "2021-01-19T21:27:51Z")

</div>

Hi! I’d like to know if there is a way to insert unlimited number of parameters into a custom function. I want to replicate things like: println(i1,i2,i3,i4,i5,...); The way I do it right now is by doing: void aaa(…

---

## [How to pass parameters into a thread function](https://discourse.processing.org/t/how-to-pass-parameters-into-a-thread-function/27204)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 1\
**Last updated:** [January 19, 2021, 8:51pm UTC](https://discourse.processing.org/t/how-to-pass-parameters-into-a-thread-function/27204 "2021-01-19T20:51:16Z")

</div>

Hi! I recently came across the function thread. However when I tried to use the function void setup() {thread("timer");} void draw() {background(frameCount % 255);} void timer(int delay, int rep) { for(int i = 0; i \<…

---

## [Issue with a sorting program](https://discourse.processing.org/t/issue-with-a-sorting-program/27163)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 7\
**Last updated:** [January 18, 2021, 6:28pm UTC](https://discourse.processing.org/t/issue-with-a-sorting-program/27163 "2021-01-18T18:28:50Z")

</div>

Hi! I started created a sorting algorithm, that inserts the highest value on first place (and swaps them) codeArrayList\<Float\> values = new ArrayList\<Float\>(); int n = 600, min = 0, max = 600, it = 0; void …

---

## [I press the Russian key, and keyCode does not change](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136)

<div class="topic-metadata">

**Author:** [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Replies:** 8\
**Last updated:** [January 17, 2021, 9:36pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136 "2021-01-17T21:36:34Z")

</div>

When using the Russian keyboard layout, not all letters have their own keyCode, such as: Б Ю Ж Э Х Ъ. On the English keyboard layout they are in the punctuation areas. However key displays them fine. the problem with …

---

## [Is there a way to get the index of an item in array](https://discourse.processing.org/t/is-there-a-way-to-get-the-index-of-an-item-in-array/27113)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [January 17, 2021, 2:57am UTC](https://discourse.processing.org/t/is-there-a-way-to-get-the-index-of-an-item-in-array/27113 "2021-01-17T02:57:29Z")

</div>

Is there a way to get the index of an item in an array of a given ArrayList? I know you could use int test(String item) { for(int i = 0; i \< items.size() && items.contains(item); i++) if(item == items.get(i)) retur…

---

## [Generalisation of function](https://discourse.processing.org/t/generalisation-of-function/27061)

<div class="topic-metadata">

**Author:** [@Rafsing](https://discourse.processing.org/u/Rafsing)\
**Replies:** 6\
**Last updated:** [January 15, 2021, 12:25am UTC](https://discourse.processing.org/t/generalisation-of-function/27061 "2021-01-15T00:25:54Z")

</div>

How can I generalize pendulumManagement() to take as arguments the names of the functions to fire and the boolean to decide on? void pendulumManagement() { if (pendul) { singlePendulumManagement(); } else { …

---

## [Fill() doesn't accept pattern](https://discourse.processing.org/t/fill-doesnt-accept-pattern/27035)

<div class="topic-metadata">

**Author:** [@j0b](https://discourse.processing.org/u/j0b)\
**Replies:** 1\
**Last updated:** [January 13, 2021, 10:45pm UTC](https://discourse.processing.org/t/fill-doesnt-accept-pattern/27035 "2021-01-13T22:45:18Z")

</div>

i am used to js canvas which accept any pattern (or image) as fillStyle() or strokeStyle(). p5js fill() apparently only works with colors. curious if there is any workaround?

---

## [Accessing processing data types from class of java package](https://discourse.processing.org/t/accessing-processing-data-types-from-class-of-java-package/27028)

<div class="topic-metadata">

**Author:** [@bhavya](https://discourse.processing.org/u/bhavya)\
**Replies:** 3\
**Last updated:** [January 13, 2021, 5:25pm UTC](https://discourse.processing.org/t/accessing-processing-data-types-from-class-of-java-package/27028 "2021-01-13T17:25:21Z")

</div>

I have learnt processing from The Coding Train. Recently I was working on some GUI functionality (i.e. Button, Slider, etc.) and thought to create a library. I know there are GUI library already exist, but I am doing for…

---

## [Image Processing With Pixels error](https://discourse.processing.org/t/image-processing-with-pixels-error/27030)

<div class="topic-metadata">

**Author:** [@ELaN](https://discourse.processing.org/u/ELaN)\
**Replies:** 2\
**Last updated:** [January 13, 2021, 4:24pm UTC](https://discourse.processing.org/t/image-processing-with-pixels-error/27030 "2021-01-13T16:24:31Z")

</div>

I’ve written this cose: \<void setup(){ size(337,450); frog=loadImage(“frog.jpg”); } void draw(){ image(frog,0,0); loadPixels(); frog.loadPixels(); for(int x=0; x\<width; x++){ for(int y=0; y\<height; y++){ int l…

---

## [What do final / static / public / private tags mean?](https://discourse.processing.org/t/what-do-final-static-public-private-tags-mean/27002)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [January 12, 2021, 10:43pm UTC](https://discourse.processing.org/t/what-do-final-static-public-private-tags-mean/27002 "2021-01-12T22:43:07Z")

</div>

Hi! In the last month, I’ve been active on the forum. I saw quite a lot of things like final int b = 3, which means that b does not change. But what do the others mean? I tried using public int b = 123 inside of setup, …

---

## [Understanding the Atan2, Please help](https://discourse.processing.org/t/understanding-the-atan2-please-help/26928)

<div class="topic-metadata">

**Author:** [@laptophead](https://discourse.processing.org/u/laptophead)\
**Replies:** 13\
**Last updated:** [January 11, 2021, 11:04am UTC](https://discourse.processing.org/t/understanding-the-atan2-please-help/26928 "2021-01-11T11:04:03Z")

</div>

I was expecting to get the degrees from the center of the sketch to the mouse from 0 to 360 or zero to 2PI. Instead I am getting zero to 180 from horizontal to the belly of the sketch and then I get negative numbers on …

---

## [How to freeze a draw loop?](https://discourse.processing.org/t/how-to-freeze-a-draw-loop/2741)

<div class="topic-metadata">

**Author:** [@wrongexit](https://discourse.processing.org/u/wrongexit)\
**Replies:** 7\
**Last updated:** [August 18, 2018, 3:12am UTC](https://discourse.processing.org/t/how-to-freeze-a-draw-loop/2741 "2018-08-18T03:12:50Z")

</div>

I have a draw loop that makes a new graphic each time. I want to be able to pause the loop by clicking the mouse when I see a graphic that I like. But everything I’ve tried fails to stop on the current frame. It’s always…

---

## [How do nested arrays such as IntDict\[\] work? (Processing 3.5.4)](https://discourse.processing.org/t/how-do-nested-arrays-such-as-intdict-work-processing-3-5-4/26818)

<div class="topic-metadata">

**Author:** [@Anon0908](https://discourse.processing.org/u/Anon0908)\
**Replies:** 1\
**Last updated:** [January 6, 2021, 7:05am UTC](https://discourse.processing.org/t/how-do-nested-arrays-such-as-intdict-work-processing-3-5-4/26818 "2021-01-06T07:05:03Z")

</div>

How do I properly invoke array commands such as append() on an IntDict\[\] array? For example, this is my current sketch testing such a thing: IntDict\[\] dictArray; void setup() { size(1400, 1000); /\*properly initializ…

---

## [How to sort an Array ArrayList?](https://discourse.processing.org/t/how-to-sort-an-array-arraylist/26809)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 8\
**Last updated:** [January 6, 2021, 6:45am UTC](https://discourse.processing.org/t/how-to-sort-an-array-arraylist/26809 "2021-01-06T06:45:32Z")

</div>

Hi! I am working on a sorting algorithm but I am still having some trouble. I have an array list ArrayList\<ArrayList\<Float\>\> segs = new ArrayList\<ArrayList\<Float\>\>(); and I want to sort() (width the default function)…

---

## [Grayscaling a given image](https://discourse.processing.org/t/grayscaling-a-given-image/26768)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 1\
**Last updated:** [January 4, 2021, 11:28am UTC](https://discourse.processing.org/t/grayscaling-a-given-image/26768 "2021-01-04T11:28:57Z")

</div>

PImage org = loadImage("data/99484011-ead8-482a-a169-820c7981896f.jpg"), gray = org; void settings() { size(org.width\*2,org.height); gray.filter(GRAY); } void draw() { image(org,0,0); filter(GRAY); image(gray…

---

## [Can someone comment this code?](https://discourse.processing.org/t/can-someone-comment-this-code/26716)

<div class="topic-metadata">

**Author:** [@popin](https://discourse.processing.org/u/popin)\
**Replies:** 14\
**Last updated:** [January 3, 2021, 10:17pm UTC](https://discourse.processing.org/t/can-someone-comment-this-code/26716 "2021-01-03T22:17:22Z")

</div>

Hey can you comment this code? i dont understand please void draw () { pushMatrix(); fill(0); translate(130, 40); //adjust position for (int k = 0; k \< myLetters.length; ++k) { for (int i = 0; i \< 4; i++) {//clarte…

---

## [Convert from HSB to RGB](https://discourse.processing.org/t/convert-from-hsb-to-rgb/26672)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 4\
**Last updated:** [January 1, 2021, 7:40pm UTC](https://discourse.processing.org/t/convert-from-hsb-to-rgb/26672 "2021-01-01T19:40:48Z")

</div>

Hi! Can someone send me a function that converts HSB input into RGB? (color formats, RGB = red, green, blue, HSB = hue, saturation, brightness (or Value if it is HSV)) preferred format: color toRGB(int h, int s, int b…

[Previous page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=20)

[Next page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=22)
