# Coding Questions

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

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

**Page:** 35

---

## [Processing and Arduino standard Firmata: switching PShape with another PShape pressing a button on Arduino](https://discourse.processing.org/t/processing-and-arduino-standard-firmata-switching-pshape-with-another-pshape-pressing-a-button-on-arduino/35162)

<div class="topic-metadata">

**Author:** [@ata](https://discourse.processing.org/u/ata)\
**Replies:** 1\
**Last updated:** [February 16, 2022, 3:33pm UTC](https://discourse.processing.org/t/processing-and-arduino-standard-firmata-switching-pshape-with-another-pshape-pressing-a-button-on-arduino/35162 "2022-02-16T15:33:41Z")

</div>

hello. i am creating an arduino machine. it is talking to processing using the library standardFirmata(arduino). in this arduino there are three elements: two buttons and a joystick. a Pshape can be moved in the sketch w…

---

## [Recombining 2 bytes into a signed int](https://discourse.processing.org/t/recombining-2-bytes-into-a-signed-int/35067)

<div class="topic-metadata">

**Author:** [@TKez](https://discourse.processing.org/u/TKez)\
**Replies:** 6\
**Last updated:** [February 16, 2022, 2:45pm UTC](https://discourse.processing.org/t/recombining-2-bytes-into-a-signed-int/35067 "2022-02-16T14:45:02Z")

</div>

Sending a byte stream over from an Arduino which includes some int16\_t values (little endian) but struggling to recombine them. This is as close as I can get, but I loose the sign. int1 = (inBuffer\[1\]\<\<8) | in…

---

## [How to make object "vibrate" before moving upwards?](https://discourse.processing.org/t/how-to-make-object-vibrate-before-moving-upwards/35157)

<div class="topic-metadata">

**Author:** [@AndrewTheGoat22](https://discourse.processing.org/u/AndrewTheGoat22)\
**Replies:** 6\
**Last updated:** [February 16, 2022, 1:03pm UTC](https://discourse.processing.org/t/how-to-make-object-vibrate-before-moving-upwards/35157 "2022-02-16T13:03:47Z")

</div>

I want to make this square move back and forth (so that it looks like it’s vibrating or shaking) for several seconds before making it go upwards. How would I go about doing that? Thanks! \< int y; int yPos=350; // con…

---

## [Reproducability of "Randomness" by Seed](https://discourse.processing.org/t/reproducability-of-randomness-by-seed/35148)

<div class="topic-metadata">

**Author:** [@Quertz](https://discourse.processing.org/u/Quertz)\
**Replies:** 14\
**Last updated:** [February 16, 2022, 1:12pm UTC](https://discourse.processing.org/t/reproducability-of-randomness-by-seed/35148 "2022-02-16T13:12:10Z")

</div>

Hi Guys, I work with Processing since 2002 or so. I love it and it is very rare that I have a problem. But now I have: It´s with the reproducability of my Algo. To get a reproducable Sequence of random-numbers, I call…

---

## [Rectangle intersections 3D](https://discourse.processing.org/t/rectangle-intersections-3d/35170)

<div class="topic-metadata">

**Author:** [@bruno.pace](https://discourse.processing.org/u/bruno.pace)\
**Replies:** 0\
**Last updated:** [February 14, 2022, 11:38pm UTC](https://discourse.processing.org/t/rectangle-intersections-3d/35170 "2022-02-14T23:38:11Z")

</div>

Hi there, I am trying to place some rotated rectangles in 3D but the rendering would be much better if the intersection lines between them would be visible. Can anyone help me do that? float x,y,z,a,b ; int num = 300 ;…

---

## [Detect Mous position inside vertex shape](https://discourse.processing.org/t/detect-mous-position-inside-vertex-shape/35160)

<div class="topic-metadata">

**Author:** [@jaspervb](https://discourse.processing.org/u/jaspervb)\
**Replies:** 1\
**Last updated:** [February 14, 2022, 4:31pm UTC](https://discourse.processing.org/t/detect-mous-position-inside-vertex-shape/35160 "2022-02-14T16:31:34Z")

</div>

Hi There, Is there a method to detect if the mouse position is inside a simple custom vertex shape. Kind regards!

---

## [Place Character into Map](https://discourse.processing.org/t/place-character-into-map/35147)

<div class="topic-metadata">

**Author:** [@Kristina](https://discourse.processing.org/u/Kristina)\
**Replies:** 2\
**Last updated:** [February 13, 2022, 7:08pm UTC](https://discourse.processing.org/t/place-character-into-map/35147 "2022-02-13T19:08:49Z")

</div>

Hi, i am working on a Tile based Game at the Moment. I have the characters and Entity’s all added but I don’t know how to place them inside of the map, while making it scroll when my character moves. Could someone pleas…

---

## [Applying vertex-shader in Processing](https://discourse.processing.org/t/applying-vertex-shader-in-processing/35131)

<div class="topic-metadata">

**Author:** [@woodwindblues](https://discourse.processing.org/u/woodwindblues)\
**Replies:** 2\
**Last updated:** [February 13, 2022, 10:50am UTC](https://discourse.processing.org/t/applying-vertex-shader-in-processing/35131 "2022-02-13T10:50:47Z")

</div>

Hi, I tried to replicate parts of this (Three.js tutorial) in Processing. I managed to generate a custom 3D Sphere with the vertices spread according to the golden ratio, but I have trouble applying the vertex displaceme…

---

## [How do you Create Shadows in Processing?](https://discourse.processing.org/t/how-do-you-create-shadows-in-processing/35128)

<div class="topic-metadata">

**Author:** [@rdcmole](https://discourse.processing.org/u/rdcmole)\
**Replies:** 0\
**Last updated:** [February 12, 2022, 5:07pm UTC](https://discourse.processing.org/t/how-do-you-create-shadows-in-processing/35128 "2022-02-12T17:07:41Z")

</div>

I am trying to make my images more realistic by adding the shadows of the rendered shapes. I thought that it may be automatic when adding directional lights, but this does not appear to work. Below is a simple test co…

---

## [Why is my sketch showing up blank?](https://discourse.processing.org/t/why-is-my-sketch-showing-up-blank/35114)

<div class="topic-metadata">

**Author:** [@JennyMcCreadie](https://discourse.processing.org/u/JennyMcCreadie)\
**Replies:** 8\
**Last updated:** [February 11, 2022, 9:53pm UTC](https://discourse.processing.org/t/why-is-my-sketch-showing-up-blank/35114 "2022-02-11T21:53:45Z")

</div>

Hello! I’ve been trying to put this code into separate tabs with classes so I can play around with changing the mouseX and mouseY to Kinect. I was wondering what’s going wrong here? Would really appreciate some help on t…

---

## [Call the Java Compiler from Processing](https://discourse.processing.org/t/call-the-java-compiler-from-processing/35076)

<div class="topic-metadata">

**Author:** [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Replies:** 4\
**Last updated:** [February 11, 2022, 3:30pm UTC](https://discourse.processing.org/t/call-the-java-compiler-from-processing/35076 "2022-02-11T15:30:08Z")

</div>

I’m currently writing a library for a few friends of mine who use Processing and it would be cool if I were to include a possibiity to compile and run Java-code. I used a code I already used for another project. However…

---

## [Problems with noise flow field](https://discourse.processing.org/t/problems-with-noise-flow-field/35082)

<div class="topic-metadata">

**Author:** [@alex119](https://discourse.processing.org/u/alex119)\
**Replies:** 0\
**Last updated:** [February 10, 2022, 9:28pm UTC](https://discourse.processing.org/t/problems-with-noise-flow-field/35082 "2022-02-10T21:28:49Z")

</div>

Hello, I try to follow the Perlin noise flow field video: I have a weird behaviour and I don’t understand why. First, here is the code, similar to the one from the video: flow\_field file: int cols, rows;…

---

## [Performance issue when rendering multiple objects](https://discourse.processing.org/t/performance-issue-when-rendering-multiple-objects/34895)

<div class="topic-metadata">

**Author:** [@CaptainChameleon](https://discourse.processing.org/u/CaptainChameleon)\
**Replies:** 8\
**Last updated:** [February 9, 2022, 9:46am UTC](https://discourse.processing.org/t/performance-issue-when-rendering-multiple-objects/34895 "2022-02-09T09:46:13Z")

</div>

Hello there! I’m trying to recreate the solar system with Processing using somewhat realistic proportions (at scale) and real astronomical data. My goal is to instill a feeling of vastness; users should get an approximat…

---

## [How do i take a input that is space separated?](https://discourse.processing.org/t/how-do-i-take-a-input-that-is-space-separated/34905)

<div class="topic-metadata">

**Author:** [@Zan](https://discourse.processing.org/u/Zan)\
**Replies:** 25\
**Last updated:** [February 9, 2022, 9:40am UTC](https://discourse.processing.org/t/how-do-i-take-a-input-that-is-space-separated/34905 "2022-02-09T09:40:18Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi, can anyone advise me on How do I take input that is space-separated? and then putting in a for loop to draw a circle

---

## [Animating spiral](https://discourse.processing.org/t/animating-spiral/35056)

<div class="topic-metadata">

**Author:** [@Prokyovec](https://discourse.processing.org/u/Prokyovec)\
**Replies:** 0\
**Last updated:** [February 8, 2022, 11:47pm UTC](https://discourse.processing.org/t/animating-spiral/35056 "2022-02-08T23:47:23Z")

</div>

Hey Everyone! I am a beginner in Processing and I have a homework to do which has to be done till friday xdd The point is I dont know what to do and I need your help :d Here is the final result how it should look like. …

---

## [Bug with points?](https://discourse.processing.org/t/bug-with-points/35046)

<div class="topic-metadata">

**Author:** [@hanslas](https://discourse.processing.org/u/hanslas)\
**Replies:** 1\
**Last updated:** [February 8, 2022, 4:09pm UTC](https://discourse.processing.org/t/bug-with-points/35046 "2022-02-08T16:09:21Z")

</div>

I’ve tried this very simple code during a Processing introduction course One of the students has a windows machine with a windows build 1904.1466 on it it turns out that the drawn line (so the points) at the last part…

---

## [Opening assets inside folders](https://discourse.processing.org/t/opening-assets-inside-folders/35010)

<div class="topic-metadata">

**Author:** [@JoseMY](https://discourse.processing.org/u/JoseMY)\
**Replies:** 3\
**Last updated:** [February 7, 2022, 7:15am UTC](https://discourse.processing.org/t/opening-assets-inside-folders/35010 "2022-02-07T07:15:03Z")

</div>

Hi! I’m doing a big project using processing. I have a bunch of files containing assets, and I want to store them in data folder/font\_assets data folder/sprite assets etc. But when I try to load them, everything fai…

---

## [Displaying, exporting generated svgs](https://discourse.processing.org/t/displaying-exporting-generated-svgs/35015)

<div class="topic-metadata">

**Author:** [@bcabc](https://discourse.processing.org/u/bcabc)\
**Replies:** 1\
**Last updated:** [February 7, 2022, 6:22am UTC](https://discourse.processing.org/t/displaying-exporting-generated-svgs/35015 "2022-02-07T06:22:10Z")

</div>

hi there - i have been through the examples of exporting svgs from processing, at this url: https://processing.org/reference/libraries/svg/index.html i am looking for a solution that falls between these examples, thou…

---

## [How to hide one side of a vertex?](https://discourse.processing.org/t/how-to-hide-one-side-of-a-vertex/34857)

<div class="topic-metadata">

**Author:** [@xerneas02](https://discourse.processing.org/u/xerneas02)\
**Replies:** 1\
**Last updated:** [February 6, 2022, 2:06pm UTC](https://discourse.processing.org/t/how-to-hide-one-side-of-a-vertex/34857 "2022-02-06T14:06:16Z")

</div>

Hello, I am working on little 3D project in processing and to do so i have create a cube using vertex (i don’t use box cause i want to be able to hide each face of the cube indivdualy) and i was wondering if it’s possib…

---

## [Time Difference](https://discourse.processing.org/t/time-difference/34858)

<div class="topic-metadata">

**Author:** [@Bunnytoes](https://discourse.processing.org/u/Bunnytoes)\
**Replies:** 6\
**Last updated:** [February 5, 2022, 11:02pm UTC](https://discourse.processing.org/t/time-difference/34858 "2022-02-05T23:02:26Z")

</div>

I want to get a change in time, but I don’t know how to do that in processing (in java I know there is Instant.Now but what is there in processing)?

---

## [Code to compare pixels by color](https://discourse.processing.org/t/code-to-compare-pixels-by-color/34764)

<div class="topic-metadata">

**Author:** [@Marn](https://discourse.processing.org/u/Marn)\
**Replies:** 20\
**Last updated:** [February 3, 2022, 9:48pm UTC](https://discourse.processing.org/t/code-to-compare-pixels-by-color/34764 "2022-02-03T21:48:36Z")

</div>

I need a script that does the following: The script should look at an image pixels by pixels. For each pixel, the script has to look for an other pixel with the same rgb value in a different image. (Possibly with a sma…

---

## [How to zoom on to center of the screen](https://discourse.processing.org/t/how-to-zoom-on-to-center-of-the-screen/14090)

<div class="topic-metadata">

**Author:** [@TheZipCreator](https://discourse.processing.org/u/TheZipCreator)\
**Replies:** 7\
**Last updated:** [February 3, 2022, 5:50pm UTC](https://discourse.processing.org/t/how-to-zoom-on-to-center-of-the-screen/14090 "2022-02-03T17:50:52Z")

</div>

So I made a zoom (and pan) function for a program I am creating, and currently it zooms on the topleft corner of the screen. I want it to zoom on the center. NOTE: I can’t use imageMode(center), without refactoring a lo…

---

## [Position loop with specific colors](https://discourse.processing.org/t/position-loop-with-specific-colors/34935)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 5\
**Last updated:** [February 1, 2022, 8:39pm UTC](https://discourse.processing.org/t/position-loop-with-specific-colors/34935 "2022-02-01T20:39:41Z")

</div>

Hi there! I have a loop with 5 quads on random positions and I want to assign a specific color to every quad. How could I control that? Thanks! void setup() { size(1000, 1000); background(255); for(int j=0; j\<5…

---

## [Flow fields code](https://discourse.processing.org/t/flow-fields-code/34592)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 14\
**Last updated:** [February 1, 2022, 12:19am UTC](https://discourse.processing.org/t/flow-fields-code/34592 "2022-02-01T00:19:35Z")

</div>

Hi there! I am trying to learn about flow fields a with a nature of code tutorial. https://natureofcode.com/book/chapter-6-autonomous-agents/ This is really difficult to me, but I would like to play with code looking f…

---

## [How do i make an images sequence run between multiple windows?](https://discourse.processing.org/t/how-do-i-make-an-images-sequence-run-between-multiple-windows/34901)

<div class="topic-metadata">

**Author:** [@green](https://discourse.processing.org/u/green)\
**Replies:** 0\
**Last updated:** [January 30, 2022, 3:53pm UTC](https://discourse.processing.org/t/how-do-i-make-an-images-sequence-run-between-multiple-windows/34901 "2022-01-30T15:53:41Z")

</div>

Hi guys, i’m having troubles understanding how to make a sequence of images (stored in a class object) run between multiple sketcehs made with the PApplet class. Here’s the code: int sec = 5; int fr = 30; int fn = sec\*f…

---

## [Patterns while zooming using PeasyCam](https://discourse.processing.org/t/patterns-while-zooming-using-peasycam/34818)

<div class="topic-metadata">

**Author:** [@yahavsh](https://discourse.processing.org/u/yahavsh)\
**Replies:** 2\
**Last updated:** [January 30, 2022, 7:29am UTC](https://discourse.processing.org/t/patterns-while-zooming-using-peasycam/34818 "2022-01-30T07:29:26Z")

</div>

Hello I’m kinda new to the community so i hope this is the right place to ask. I played a little with 3D Chaos game to create fractals, while doing so i tried to make a 2d shape in 3d space made of dots. I was surpris…

---

## [Set gradient background in a 3d sketch](https://discourse.processing.org/t/set-gradient-background-in-a-3d-sketch/34889)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 1\
**Last updated:** [January 29, 2022, 11:53pm UTC](https://discourse.processing.org/t/set-gradient-background-in-a-3d-sketch/34889 "2022-01-29T23:53:45Z")

</div>

Hello everyone, I am trying to make a 3d game in processing, but I want to set a gradient as a background. In order to do this, I made a function that creates a linear gradient and just draws it onto the screen in 2d be…

---

## [Duplicate field sketch](https://discourse.processing.org/t/duplicate-field-sketch/34865)

<div class="topic-metadata">

**Author:** [@PARINAZ129](https://discourse.processing.org/u/PARINAZ129)\
**Replies:** 2\
**Last updated:** [January 27, 2022, 10:31pm UTC](https://discourse.processing.org/t/duplicate-field-sketch/34865 "2022-01-27T22:31:45Z")

</div>

Dear I added png file to my project to do some interactive project however do to PImage koofi I faced an error on this line which is duplicate field sketch .May I ask you helping me? PImage koofi; import java.util.Cal…

---

## [Using println to show a random color that's picked](https://discourse.processing.org/t/using-println-to-show-a-random-color-thats-picked/34367)

<div class="topic-metadata">

**Author:** [@jsco](https://discourse.processing.org/u/jsco)\
**Replies:** 7\
**Last updated:** [January 25, 2022, 9:31pm UTC](https://discourse.processing.org/t/using-println-to-show-a-random-color-thats-picked/34367 "2022-01-25T21:31:32Z")

</div>

Hi, I have set println for some different number variables and I have it working just fine. But I have a color picker set up as such; \< int selected = (int)random(0, 20); int choicesR\[\] = {51, 12, 25, 18, 33, 5, 15, 7…

---

## [Code "if' and 'else if' error](https://discourse.processing.org/t/code-if-and-else-if-error/34804)

<div class="topic-metadata">

**Author:** [@Copious-plains](https://discourse.processing.org/u/Copious-plains)\
**Replies:** 4\
**Last updated:** [January 25, 2022, 1:46am UTC](https://discourse.processing.org/t/code-if-and-else-if-error/34804 "2022-01-25T01:46:10Z")

</div>

Hello, This is my first step in processing and I have had some coding lessons behind me. I have to make a pattern generator and I have almost 1 pattern behind me. However, I have a problem when it comes to code '50: 5…

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

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