# Coding Questions

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

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

**Page:** 153

---

## [How to make an object smoothly transition to a new location?](https://discourse.processing.org/t/how-to-make-an-object-smoothly-transition-to-a-new-location/7980)

<div class="topic-metadata">

**Author:** [@kirkpatrick876](https://discourse.processing.org/u/kirkpatrick876)\
**Replies:** 3\
**Last updated:** [February 3, 2019, 5:55pm UTC](https://discourse.processing.org/t/how-to-make-an-object-smoothly-transition-to-a-new-location/7980 "2019-02-03T17:55:48Z")

</div>

Hello I am trying to make a program in which an ellipse is redrawn at any point in the canvas where the mouse is clicked, although I am stuck on one problem. I am trying to get the ellipse to move smoothly from point A (…

---

## [Displaying image slows down program](https://discourse.processing.org/t/displaying-image-slows-down-program/8001)

<div class="topic-metadata">

**Author:** [@8BitRift](https://discourse.processing.org/u/8BitRift)\
**Replies:** 1\
**Last updated:** [February 1, 2019, 1:28am UTC](https://discourse.processing.org/t/displaying-image-slows-down-program/8001 "2019-02-01T01:28:38Z")

</div>

EDIT I figured out why the the program was slowing down but this has spawned a new question I have with the same title so ill just reword it. Why does rendering a copied image cripple framerate, for example: PImage ima…

---

## [\[SOLVED\] Instantiating a particular class constructor using reflection](https://discourse.processing.org/t/solved-instantiating-a-particular-class-constructor-using-reflection/7968)

<div class="topic-metadata">

**Author:** [@Aleksi](https://discourse.processing.org/u/Aleksi)\
**Replies:** 22\
**Last updated:** [January 30, 2019, 9:46pm UTC](https://discourse.processing.org/t/solved-instantiating-a-particular-class-constructor-using-reflection/7968 "2019-01-30T21:46:50Z")

</div>

Hello again, oh great Java gurus! :star\_struck: I find myself having to instantiate a class from a string using one of its particular constructors. The api for getDeclaredConstructors() indicates this is possible, but t…

---

## [Error convert slice&push from P5.js to Processing](https://discourse.processing.org/t/error-convert-slice-push-from-p5-js-to-processing/7964)

<div class="topic-metadata">

**Author:** [@miasoft](https://discourse.processing.org/u/miasoft)\
**Replies:** 1\
**Last updated:** [January 30, 2019, 4:19pm UTC](https://discourse.processing.org/t/error-convert-slice-push-from-p5-js-to-processing/7964 "2019-01-30T16:19:49Z")

</div>

I want to convert Pong.js to Processing. I have two error: int\[\] walls=new int\[4\]; //= \[\]; //----------------------- .... //------------------------ void wallAdder() { if (millis()-lastAddTime \> wallInterval) { i…

---

## [TableRow returning NaN values](https://discourse.processing.org/t/tablerow-returning-nan-values/7955)

<div class="topic-metadata">

**Author:** [@morphogencc](https://discourse.processing.org/u/morphogencc)\
**Replies:** 4\
**Last updated:** [January 30, 2019, 3:39pm UTC](https://discourse.processing.org/t/tablerow-returning-nan-values/7955 "2019-01-30T15:39:12Z")

</div>

Hello – I’m working on a project that uses CSV data to drive the graphics; I created a Show Control class that reads all of the csv files in a folder, and then grabs the next available row from the current file to provid…

---

## [How to create better timers?](https://discourse.processing.org/t/how-to-create-better-timers/7938)

<div class="topic-metadata">

**Author:** [@Schred](https://discourse.processing.org/u/Schred)\
**Replies:** 4\
**Last updated:** [January 30, 2019, 3:17pm UTC](https://discourse.processing.org/t/how-to-create-better-timers/7938 "2019-01-30T15:17:24Z")

</div>

Hi! So I have experimented with timers before (on a basic level), but never got anything elegant. Actually I think my approach is pretty messy. I’m working on a small game at the moment, and want to add more objects to …

---

## [Keypressed strange behaviour : detects all keys despite the conditionals, execute codes it's not supposed to](https://discourse.processing.org/t/keypressed-strange-behaviour-detects-all-keys-despite-the-conditionals-execute-codes-its-not-supposed-to/7960)

<div class="topic-metadata">

**Author:** [@LascarCapable](https://discourse.processing.org/u/LascarCapable)\
**Replies:** 2\
**Last updated:** [January 30, 2019, 12:53pm UTC](https://discourse.processing.org/t/keypressed-strange-behaviour-detects-all-keys-despite-the-conditionals-execute-codes-its-not-supposed-to/7960 "2019-01-30T12:53:29Z")

</div>

Hello there. Hopefully I am posting at the right place. I am trying to get a keyPressed function to work so it changes the mode of my program, thus changing the properties of the moving ellipses shown in the application…

---

## [Self rendering objects?](https://discourse.processing.org/t/self-rendering-objects/4427)

<div class="topic-metadata">

**Author:** [@GaizkaNaz](https://discourse.processing.org/u/GaizkaNaz)\
**Replies:** 11\
**Last updated:** [January 30, 2019, 11:49am UTC](https://discourse.processing.org/t/self-rendering-objects/4427 "2019-01-30T11:49:55Z")

</div>

Hello everybody! I’m working on my own GUI project. Can someone point me on the right direction to make “self rendering objects”? For example, ive got a class Buttons, i would like to make an instance of that class and…

---

## [P2D Renderer slows sketch down to extreme framerate](https://discourse.processing.org/t/p2d-renderer-slows-sketch-down-to-extreme-framerate/7674)

<div class="topic-metadata">

**Author:** [@kleinesfilmroellchen](https://discourse.processing.org/u/kleinesfilmroellchen)\
**Replies:** 10\
**Last updated:** [January 30, 2019, 4:23am UTC](https://discourse.processing.org/t/p2d-renderer-slows-sketch-down-to-extreme-framerate/7674 "2019-01-30T04:23:53Z")

</div>

I have been writing a Processing application/sketch in Eclipse (due to external libraries and heavy OOP) and stumbled upon this problem: During the drawing process (initialized from a normal draw() method in my PApplet …

---

## [Clicking on one image and permanently hiding it](https://discourse.processing.org/t/clicking-on-one-image-and-permanently-hiding-it/7918)

<div class="topic-metadata">

**Author:** [@1schroeteeri](https://discourse.processing.org/u/1schroeteeri)\
**Replies:** 3\
**Last updated:** [January 30, 2019, 3:47am UTC](https://discourse.processing.org/t/clicking-on-one-image-and-permanently-hiding-it/7918 "2019-01-30T03:47:46Z")

</div>

(Hi, I’m relatively new to processing and I’ve searched around for an answer but haven’t found anything regarding this besides making the image disappear for a moment) I’m trying to remove permanently (or hide) one imag…

---

## [Did I found a bug?](https://discourse.processing.org/t/did-i-found-a-bug/7946)

<div class="topic-metadata">

**Author:** [@EricRogerGarcia](https://discourse.processing.org/u/EricRogerGarcia)\
**Replies:** 2\
**Last updated:** [January 29, 2019, 8:32pm UTC](https://discourse.processing.org/t/did-i-found-a-bug/7946 "2019-01-29T20:32:20Z")

</div>

Hello, Trying do make a delta variable to store the time since the precedent frame I made this sketch. It seems to work fine but after about 1 minute my little sprite is stucked ??? … And now, it runs fullscreen ??? wi…

---

## [How to shorten code](https://discourse.processing.org/t/how-to-shorten-code/7883)

<div class="topic-metadata">

**Author:** [@jcop](https://discourse.processing.org/u/jcop)\
**Replies:** 5\
**Last updated:** [January 29, 2019, 7:23pm UTC](https://discourse.processing.org/t/how-to-shorten-code/7883 "2019-01-29T19:23:25Z")

</div>

I am having trouble trying to shorten this code. The code that is taking up the most space is the vertex which are the stars. Is there a way to shorten the code for the stars? void polygon(int n, float cx, float cy, flo…

---

## [PGraphics + noSmooth() + alpha = drawing artifacts](https://discourse.processing.org/t/pgraphics-nosmooth-alpha-drawing-artifacts/7892)

<div class="topic-metadata">

**Author:** [@Kevin](https://discourse.processing.org/u/Kevin)\
**Replies:** 3\
**Last updated:** [January 29, 2019, 6:06pm UTC](https://discourse.processing.org/t/pgraphics-nosmooth-alpha-drawing-artifacts/7892 "2019-01-29T18:06:53Z")

</div>

Note: I also asked this question on Stack Overflow here. I have this sample code: PGraphics pg; void setup() { size(400, 500); pg = createGraphics(width, height); pg.noSmooth(); pg.beginDraw(); pg.backgroun…

---

## [Increasing a triangle's size based on cursor's position](https://discourse.processing.org/t/increasing-a-triangles-size-based-on-cursors-position/7889)

<div class="topic-metadata">

**Author:** [@sim](https://discourse.processing.org/u/sim)\
**Replies:** 2\
**Last updated:** [January 29, 2019, 6:31pm UTC](https://discourse.processing.org/t/increasing-a-triangles-size-based-on-cursors-position/7889 "2019-01-29T18:31:21Z")

</div>

I’m trying to create a triangle which will be its smallest size at the top of the canvas and largest at the bottom. so far I have the code to just simply create a triangle that follows my mouse cursor but I don’t know h…

---

## [Mousepressed in certain area (toggle on/off)](https://discourse.processing.org/t/mousepressed-in-certain-area-toggle-on-off/7936)

<div class="topic-metadata">

**Author:** [@airimints](https://discourse.processing.org/u/airimints)\
**Replies:** 1\
**Last updated:** [January 29, 2019, 4:26pm UTC](https://discourse.processing.org/t/mousepressed-in-certain-area-toggle-on-off/7936 "2019-01-29T16:26:22Z")

</div>

I’m new to processing and this should be really easy to solve but I’m kind of stuck. So basicially, this is a snippet of my programm. What I want to achieve is that if I click on a button, it shows another picture and i…

---

## [Make button disappear when clicked](https://discourse.processing.org/t/make-button-disappear-when-clicked/7916)

<div class="topic-metadata">

**Author:** [@madsstella](https://discourse.processing.org/u/madsstella)\
**Replies:** 2\
**Last updated:** [January 29, 2019, 3:20am UTC](https://discourse.processing.org/t/make-button-disappear-when-clicked/7916 "2019-01-29T03:20:49Z")

</div>

I know this is simple, probably. I just can’t figure it out on my own :frowning: I want to make an interactive character builder through asking questions and choosing options. I got the start menu up, with a button that …

---

## [Trying to draw grid of rotated rectangles -- not centering?](https://discourse.processing.org/t/trying-to-draw-grid-of-rotated-rectangles-not-centering/7906)

<div class="topic-metadata">

**Author:** [@sorenkirk](https://discourse.processing.org/u/sorenkirk)\
**Replies:** 3\
**Last updated:** [January 29, 2019, 3:07am UTC](https://discourse.processing.org/t/trying-to-draw-grid-of-rotated-rectangles-not-centering/7906 "2019-01-29T03:07:44Z")

</div>

I am trying to simply draw a centered grid of 5 rectangles but (1) the grid is not centered and (2) it draws 6. Can anyone help me out on what I’m doing wrong? int margin = 150; int rectH = 60; int rectW = 20; int n\_rec…

---

## [Multiple Objects question](https://discourse.processing.org/t/multiple-objects-question/7910)

<div class="topic-metadata">

**Author:** [@CodeTime](https://discourse.processing.org/u/CodeTime)\
**Replies:** 2\
**Last updated:** [January 29, 2019, 1:47am UTC](https://discourse.processing.org/t/multiple-objects-question/7910 "2019-01-29T01:47:58Z")

</div>

So I am trying to make chess with my limited knowledge and got stuck at a part. I have two objects (two white pawns) on the board but if I move them, they leave behind themselves as they are dragged across the screen. Th…

---

## [Convert java bufferedimage to PImage](https://discourse.processing.org/t/convert-java-bufferedimage-to-pimage/3059)

<div class="topic-metadata">

**Author:** [@sulin](https://discourse.processing.org/u/sulin)\
**Replies:** 12\
**Last updated:** [January 28, 2019, 10:44pm UTC](https://discourse.processing.org/t/convert-java-bufferedimage-to-pimage/3059 "2019-01-28T22:44:55Z")

</div>

I am using processing.core in java to work with layered psd images using TwelveMonkeys imageIO plugins. I can successfully read and display the layers of the image using swift but cant seem to figure out how to convert t…

---

## [Inverse matrix and linear equation](https://discourse.processing.org/t/inverse-matrix-and-linear-equation/7711)

<div class="topic-metadata">

**Author:** [@Feltopi](https://discourse.processing.org/u/Feltopi)\
**Replies:** 5\
**Last updated:** [January 27, 2019, 10:59pm UTC](https://discourse.processing.org/t/inverse-matrix-and-linear-equation/7711 "2019-01-27T22:59:31Z")

</div>

Hello there, is there any way to make inverse matrix to solve linear equation, or any other way of doing it? Im new to programing and processing itself, but i would like to make a program to building statics, which inv…

---

## [How to embed a Processing sketch onto an HTML](https://discourse.processing.org/t/how-to-embed-a-processing-sketch-onto-an-html/7265)

<div class="topic-metadata">

**Author:** [@delorean](https://discourse.processing.org/u/delorean)\
**Replies:** 6\
**Last updated:** [January 28, 2019, 2:21pm UTC](https://discourse.processing.org/t/how-to-embed-a-processing-sketch-onto-an-html/7265 "2019-01-28T14:21:47Z")

</div>

Hi everyone, I’m very new to processing and programming, I hope you can help, I have bee trying to embed a Processing sketch onto an HTML using this information: https://cs.nyu.edu/~kapp/cs101/processing\_on\_the\_web/ th…

---

## [\[SOLVED\] Strange behavior using PGraphics as a recursive draw buffer](https://discourse.processing.org/t/solved-strange-behavior-using-pgraphics-as-a-recursive-draw-buffer/7699)

<div class="topic-metadata">

**Author:** [@picunrelated](https://discourse.processing.org/u/picunrelated)\
**Replies:** 9\
**Last updated:** [January 28, 2019, 10:05am UTC](https://discourse.processing.org/t/solved-strange-behavior-using-pgraphics-as-a-recursive-draw-buffer/7699 "2019-01-28T10:05:13Z")

</div>

Recently, I’ve been attempting to recreate a lot of my old Adobe Flash visualizations using Processing. Unfortunately, certain things seem to be much more difficult in Processing, at least for me right now. One thing I…

---

## [GLSL Shader on 3D Ring not working](https://discourse.processing.org/t/glsl-shader-on-3d-ring-not-working/7757)

<div class="topic-metadata">

**Author:** [@pblancos](https://discourse.processing.org/u/pblancos)\
**Replies:** 11\
**Last updated:** [January 28, 2019, 9:09am UTC](https://discourse.processing.org/t/glsl-shader-on-3d-ring-not-working/7757 "2019-01-28T09:09:07Z")

</div>

I’m try to map GLSL texture shader to 3D ring, I’ve got little working, but I think i’m miss some translation to 3D (i think), as it’s mapping it to 2D. I try use fragment from processing site. Where am I going wrong? s…

---

## [Strange Behavior Triggered by image() Function](https://discourse.processing.org/t/strange-behavior-triggered-by-image-function/7638)

<div class="topic-metadata">

**Author:** [@JackWitherell](https://discourse.processing.org/u/JackWitherell)\
**Replies:** 19\
**Last updated:** [January 28, 2019, 1:30am UTC](https://discourse.processing.org/t/strange-behavior-triggered-by-image-function/7638 "2019-01-28T01:30:51Z")

</div>

Hey there. First post, haven’t figured out if there’s anywhere else I could go for similar questions, thought I should ask here before creating an issue on Processing’s github issues board. I’ve found some really strang…

---

## [New Functions in PROCESSING 3.5](https://discourse.processing.org/t/new-functions-in-processing-3-5/7723)

<div class="topic-metadata">

**Author:** [@jonzamarripa](https://discourse.processing.org/u/jonzamarripa)\
**Replies:** 8\
**Last updated:** [January 27, 2019, 8:32pm UTC](https://discourse.processing.org/t/new-functions-in-processing-3-5/7723 "2019-01-27T20:32:35Z")

</div>

I just updated my processing to 3.5 and I saw that they added circle () and square() Does anyone know the syntax and parameters of these functions? I think it’s exciting to have these new features.

---

## [Shape function draws nothing when given width and height](https://discourse.processing.org/t/shape-function-draws-nothing-when-given-width-and-height/7877)

<div class="topic-metadata">

**Author:** [@resbot](https://discourse.processing.org/u/resbot)\
**Replies:** 2\
**Last updated:** [January 27, 2019, 2:37pm UTC](https://discourse.processing.org/t/shape-function-draws-nothing-when-given-width-and-height/7877 "2019-01-27T14:37:16Z")

</div>

I am defining a custom PShape and attempting to redraw it a variable sizes. When I simply use the command shape(shapename, x, y) it draws correctly. When I use shape(shapename, a, b, c, d) where c and d are the width a…

---

## [Map point onto 135-degree line then onto x- and y-axis intercepts](https://discourse.processing.org/t/map-point-onto-135-degree-line-then-onto-x-and-y-axis-intercepts/7870)

<div class="topic-metadata">

**Author:** [@ottenm](https://discourse.processing.org/u/ottenm)\
**Replies:** 3\
**Last updated:** [January 27, 2019, 2:20pm UTC](https://discourse.processing.org/t/map-point-onto-135-degree-line-then-onto-x-and-y-axis-intercepts/7870 "2019-01-27T14:20:46Z")

</div>

Given any point on the screen (mouseX, mouseY) I need to draw a triangle bordered by a 135-degree line through that point (slope == -1) and by the left and bottom axes. In other words, anchored on the bottom-left corner…

---

## [How to REMOVE Title Bar](https://discourse.processing.org/t/how-to-remove-title-bar/7537)

<div class="topic-metadata">

**Author:** [@santosh](https://discourse.processing.org/u/santosh)\
**Replies:** 9\
**Last updated:** [January 27, 2019, 9:51am UTC](https://discourse.processing.org/t/how-to-remove-title-bar/7537 "2019-01-27T09:51:29Z")

</div>

How to REMOVE Title Bar???

---

## [Why can't I set PShape's stroke with P2D](https://discourse.processing.org/t/why-cant-i-set-pshapes-stroke-with-p2d/7859)

<div class="topic-metadata">

**Author:** [@kikinnaz](https://discourse.processing.org/u/kikinnaz)\
**Replies:** 3\
**Last updated:** [January 27, 2019, 7:41am UTC](https://discourse.processing.org/t/why-cant-i-set-pshapes-stroke-with-p2d/7859 "2019-01-27T07:41:51Z")

</div>

Hi everyone, I was wondering whether I overlooked an important piece of information or whether it is a bug. When I create my PShape and set it a stroke color, it is completely ignored when using P2D and I cannot find a …

---

## [Trigonometry instead of rotate()](https://discourse.processing.org/t/trigonometry-instead-of-rotate/7848)

<div class="topic-metadata">

**Author:** [@Ov3rM1nD](https://discourse.processing.org/u/Ov3rM1nD)\
**Replies:** 4\
**Last updated:** [January 26, 2019, 8:31pm UTC](https://discourse.processing.org/t/trigonometry-instead-of-rotate/7848 "2019-01-26T20:31:23Z")

</div>

Hello everybody. I’m making my own Triangle class that builds triangle objects with some unique features like collision detection, rotate (), centerMode () (which can be VERTEX, CENTROID, CIRCUNCENTER, etc), and a few ot…

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

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