# Latest

**URL:** https://discourse.processing.org/latest.md?no_subcategories=false&page=272

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

**Page:** 273

---

## [Getting the error Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0](https://discourse.processing.org/t/getting-the-error-uncaught-domexception-failed-to-execute-drawimage-on-canvasrenderingcontext2d-the-image-argument-is-a-canvas-element-with-a-width-or-height-of-0/26419)

<div class="topic-metadata">

**Author:** [@EliteDaMyth](https://discourse.processing.org/u/EliteDaMyth)\
**Replies:** 1\
**Last updated:** [December 22, 2020, 8:45am UTC](https://discourse.processing.org/t/getting-the-error-uncaught-domexception-failed-to-execute-drawimage-on-canvasrenderingcontext2d-the-image-argument-is-a-canvas-element-with-a-width-or-height-of-0/26419 "2020-12-22T08:45:58Z")

</div>

I am trying to make a Delaunay triangulation sketch in p5. i have successfully made it to work with an image url. i want to allow the user to upload some images too, but when i am trying to do so, i get the following err…

---

## [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…

---

## [Beginner made Solar System 3D Simulation](https://discourse.processing.org/t/beginner-made-solar-system-3d-simulation/23551)

<div class="topic-metadata">

**Author:** [@B0tOx](https://discourse.processing.org/u/B0tOx)\
**Replies:** 18\
**Last updated:** [December 22, 2020, 3:39am UTC](https://discourse.processing.org/t/beginner-made-solar-system-3d-simulation/23551 "2020-12-22T03:39:41Z")

</div>

I have not done much with Processing, not more than 5 projects. This is, by far, the one I am most proud of. I have not followed any tutorials, used code from others (expect the PeasyCam library) nor have I looked at exa…

---

## [Error (: line 0)](https://discourse.processing.org/t/error-line-0/26427)

<div class="topic-metadata">

**Author:** [@iris.go](https://discourse.processing.org/u/iris.go)\
**Replies:** 5\
**Last updated:** [December 21, 2020, 10:56pm UTC](https://discourse.processing.org/t/error-line-0/26427 "2020-12-21T22:56:07Z")

</div>

Good day, I am new to this forum and would like to have your advice concerning an error which I am not able to solve. When I run the code below (tree simulation) in p5js, it gives me this error : Script error. (: line …

---

## [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…

---

## [Why do I get this error message? Ellipse was expecting Number](https://discourse.processing.org/t/why-do-i-get-this-error-message-ellipse-was-expecting-number/26428)

<div class="topic-metadata">

**Author:** [@olaf000olaf](https://discourse.processing.org/u/olaf000olaf)\
**Replies:** 2\
**Last updated:** [December 21, 2020, 9:06pm UTC](https://discourse.processing.org/t/why-do-i-get-this-error-message-ellipse-was-expecting-number/26428 "2020-12-21T21:06:50Z")

</div>

This is my code https://www.openprocessing.org/sketch/1048449# if you’re wondering what the image I’m using is it’s my gf.

---

## [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 …

---

## [How to check for a color in an area](https://discourse.processing.org/t/how-to-check-for-a-color-in-an-area/17616)

<div class="topic-metadata">

**Author:** [@Yannik](https://discourse.processing.org/u/Yannik)\
**Replies:** 10\
**Last updated:** [December 21, 2020, 5:01pm UTC](https://discourse.processing.org/t/how-to-check-for-a-color-in-an-area/17616 "2020-12-21T17:01:40Z")

</div>

How can I check, if there is a specific color in an area? Like: If(color in area(10,100,50,600) == color(0,0,255)){ run code }

---

## [EndShape call inside mouseDragged doesn't work in instanciated mode](https://discourse.processing.org/t/endshape-call-inside-mousedragged-doesnt-work-in-instanciated-mode/26413)

<div class="topic-metadata">

**Author:** [@nahiko](https://discourse.processing.org/u/nahiko)\
**Replies:** 3\
**Last updated:** [December 21, 2020, 3:26pm UTC](https://discourse.processing.org/t/endshape-call-inside-mousedragged-doesnt-work-in-instanciated-mode/26413 "2020-12-21T15:26:39Z")

</div>

Hi guys, It’s all in the title, here is an example of the code: var s1 = function( sketch ) { sketch.setup = function() { let canvas1 = sketch.createCanvas(400, 400, sketch.WEBGL); canvas1.position(0,0); canvas1.ba…

---

## [Making the variables into arrays, just to make the code more optimal](https://discourse.processing.org/t/making-the-variables-into-arrays-just-to-make-the-code-more-optimal/26368)

<div class="topic-metadata">

**Author:** [@GoWithTheFloe](https://discourse.processing.org/u/GoWithTheFloe)\
**Replies:** 3\
**Last updated:** [December 21, 2020, 2:33pm UTC](https://discourse.processing.org/t/making-the-variables-into-arrays-just-to-make-the-code-more-optimal/26368 "2020-12-21T14:33:54Z")

</div>

Hello, I am a beginner and I am trying to make my code more optimal and look more professional. I have some variables that are called the same but they all end with the numbers 0,1, 2 and so on. I ask this question whil…

---

## [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…

---

## [Help with my own Game](https://discourse.processing.org/t/help-with-my-own-game/26320)

<div class="topic-metadata">

**Author:** [@Rogo](https://discourse.processing.org/u/Rogo)\
**Replies:** 26\
**Last updated:** [December 20, 2020, 10:56pm UTC](https://discourse.processing.org/t/help-with-my-own-game/26320 "2020-12-20T22:56:35Z")

</div>

How can i fix it? Code: float xg; float rx = 500; float ry = 1300; float rw = 100; float rh = 100; float linksX = 100; float linksY = 1300; float linksW = 100; float linksH = 100; void setup() { xg = 325; orientati…

---

## [How can i use external libraries? (com.google.xyz)](https://discourse.processing.org/t/how-can-i-use-external-libraries-com-google-xyz/26404)

<div class="topic-metadata">

**Author:** [@EinsMalteHH](https://discourse.processing.org/u/EinsMalteHH)\
**Replies:** 1\
**Last updated:** [December 20, 2020, 9:11pm UTC](https://discourse.processing.org/t/how-can-i-use-external-libraries-com-google-xyz/26404 "2020-12-20T21:11:49Z")

</div>

How can i use external libraries? import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; import com.google.api.client.extensions.…

---

## [Having keyPressed() in multiple classes](https://discourse.processing.org/t/having-keypressed-in-multiple-classes/26401)

<div class="topic-metadata">

**Author:** [@gapigapi](https://discourse.processing.org/u/gapigapi)\
**Replies:** 2\
**Last updated:** [December 20, 2020, 6:53pm UTC](https://discourse.processing.org/t/having-keypressed-in-multiple-classes/26401 "2020-12-20T18:53:30Z")

</div>

I am having some problems with void keypress() function. If i use it in the main class it works, but if i then try to call a class where i do the maths and then draw() which works in that class and draw on canvas create…

---

## [Countdown d, h, min, sec and ms?](https://discourse.processing.org/t/countdown-d-h-min-sec-and-ms/18145)

<div class="topic-metadata">

**Author:** [@Teljemo](https://discourse.processing.org/u/Teljemo)\
**Replies:** 13\
**Last updated:** [December 20, 2020, 1:48pm UTC](https://discourse.processing.org/t/countdown-d-h-min-sec-and-ms/18145 "2020-12-20T13:48:37Z")

</div>

Hi I googled this a fair amount now and cant really find a answer. Can someone point me in the right direction here :slight\_smile: I’ve just got a date for when we will have a visit from the man who owns our company. …

---

## [Slider and led help](https://discourse.processing.org/t/slider-and-led-help/26392)

<div class="topic-metadata">

**Author:** [@r0x15](https://discourse.processing.org/u/r0x15)\
**Replies:** 1\
**Last updated:** [December 20, 2020, 11:49am UTC](https://discourse.processing.org/t/slider-and-led-help/26392 "2020-12-20T11:49:12Z")

</div>

Good morning I open another post because I am not convinced of the answers I have been given regarding my problem perhaps due to the misunderstanding of English (google translated) and therefore the problem is not well…

---

## [Struggling to implement a pause/delay within my for-loop](https://discourse.processing.org/t/struggling-to-implement-a-pause-delay-within-my-for-loop/26313)

<div class="topic-metadata">

**Author:** [@mon](https://discourse.processing.org/u/mon)\
**Replies:** 15\
**Last updated:** [December 20, 2020, 1:51am UTC](https://discourse.processing.org/t/struggling-to-implement-a-pause-delay-within-my-for-loop/26313 "2020-12-20T01:51:36Z")

</div>

Beginner here. I am developing a program that involves drawing a grid of cells, in a row-by-row fashion. I want the program to draw a row of cells, then pause for a short time (say 1 second) before moving down and drawi…

---

## [Help determining data type](https://discourse.processing.org/t/help-determining-data-type/26233)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 14\
**Last updated:** [December 19, 2020, 11:57pm UTC](https://discourse.processing.org/t/help-determining-data-type/26233 "2020-12-19T23:57:03Z")

</div>

Hi! I started doing the java coding challenges from edabit.com. There is a challenge where you need to filter out Strings from an array and only leave numbers. https://edabit.com/challenge/vNszi3mbJA5BhgGFX ( turn \[4,1…

---

## [Strange text-displacement within grid-spaced typography](https://discourse.processing.org/t/strange-text-displacement-within-grid-spaced-typography/26384)

<div class="topic-metadata">

**Author:** [@Namrad](https://discourse.processing.org/u/Namrad)\
**Replies:** 1\
**Last updated:** [December 19, 2020, 4:45pm UTC](https://discourse.processing.org/t/strange-text-displacement-within-grid-spaced-typography/26384 "2020-12-19T16:45:41Z")

</div>

Hello, The idea for a project I’m working on rests on the use of typography in a grid. I wanted to put one letter in the center (x) of every cell of this grid. The size of the letter would be determined/altered by an un…

---

## [G4P - How to disable 'You might want to add...' console message?](https://discourse.processing.org/t/g4p-how-to-disable-you-might-want-to-add-console-message/26373)

<div class="topic-metadata">

**Author:** [@MauiMana](https://discourse.processing.org/u/MauiMana)\
**Replies:** 1\
**Last updated:** [December 19, 2020, 2:35pm UTC](https://discourse.processing.org/t/g4p-how-to-disable-you-might-want-to-add-console-message/26373 "2020-12-19T14:35:34Z")

</div>

Is there any way of disabling the automatic message that gets output to the console suggesting that one adds a method to handle, for example, GButton events? In using GButtons I typically assign handlers at the specific …

---

## [How to bounce a ball off a randomly generated line?](https://discourse.processing.org/t/how-to-bounce-a-ball-off-a-randomly-generated-line/26379)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 1\
**Last updated:** [December 19, 2020, 11:13am UTC](https://discourse.processing.org/t/how-to-bounce-a-ball-off-a-randomly-generated-line/26379 "2020-12-19T11:13:39Z")

</div>

Hi! I recently made a bouncing ball program float x = 300, y = 300, r = 30, xs = 10, ys = 8, friction = 0.9; void setup() { size(600,600); } void draw() { background(0); circle(x,y,r\*2); x+=xs; y+=ys; i…

---

## [Issue with expecting }, found 'else'](https://discourse.processing.org/t/issue-with-expecting-found-else/26377)

<div class="topic-metadata">

**Author:** [@yevsym](https://discourse.processing.org/u/yevsym)\
**Replies:** 8\
**Last updated:** [December 19, 2020, 10:33am UTC](https://discourse.processing.org/t/issue-with-expecting-found-else/26377 "2020-12-19T10:33:23Z")

</div>

I wrote this code, but Processing keeps telling me about the “expecting }, found ‘else’” error. I checked my code many times, but I just stick at missing out the mistake. Please help out, if you spot it. void draw() { …

---

## [For-loop problem: space between rotating squares](https://discourse.processing.org/t/for-loop-problem-space-between-rotating-squares/26370)

<div class="topic-metadata">

**Author:** [@trelosti](https://discourse.processing.org/u/trelosti)\
**Replies:** 2\
**Last updated:** [December 19, 2020, 8:18am UTC](https://discourse.processing.org/t/for-loop-problem-space-between-rotating-squares/26370 "2020-12-19T08:18:01Z")

</div>

Good day, I am a beginner in Processing and programming in general, and recently my teacher gave me a task to implement the following thing in Processing: draw a big square consisting of smaller squares and move it acro…

---

## [2D graph library for p5.js](https://discourse.processing.org/t/2d-graph-library-for-p5-js/26374)

<div class="topic-metadata">

**Author:** [@Jithin](https://discourse.processing.org/u/Jithin)\
**Replies:** 0\
**Last updated:** [December 19, 2020, 6:18am UTC](https://discourse.processing.org/t/2d-graph-library-for-p5-js/26374 "2020-12-19T06:18:28Z")

</div>

Hello community members I’ve created a 2d graph library that can be used with p5.js. Here is a sample code in web editor I’m sharing the github repo for the library here. You are free to use the library as well as …

---

## [bezierVertex() draws straight lines, not a curved line?](https://discourse.processing.org/t/beziervertex-draws-straight-lines-not-a-curved-line/3139)

<div class="topic-metadata">

**Author:** [@tony](https://discourse.processing.org/u/tony)\
**Replies:** 7\
**Last updated:** [December 18, 2020, 7:27pm UTC](https://discourse.processing.org/t/beziervertex-draws-straight-lines-not-a-curved-line/3139 "2020-12-18T19:27:15Z")

</div>

I thought I was using bezierVertex() correctly, but what the hey. void setup() { size(512,512); PShape bez = createShape(); bez.beginShape(); bez.noFill(); bez.stroke(255,0,0); bez.strokeWeight(2); bez.…

---

## [Get the ID of an android touch that has just ended?](https://discourse.processing.org/t/get-the-id-of-an-android-touch-that-has-just-ended/21097)

<div class="topic-metadata">

**Author:** [@Nicholas](https://discourse.processing.org/u/Nicholas)\
**Replies:** 2\
**Last updated:** [December 18, 2020, 7:06pm UTC](https://discourse.processing.org/t/get-the-id-of-an-android-touch-that-has-just-ended/21097 "2020-12-18T19:06:59Z")

</div>

I’m making an android app with multi touch and when a finger leaves the screen, I’d like to know which one it was because I’m tracking how long it has been since each started. Can I do something like this: void touchEn…

---

## [Png save and screen capture producing different results](https://discourse.processing.org/t/png-save-and-screen-capture-producing-different-results/26296)

<div class="topic-metadata">

**Author:** [@saltandonion](https://discourse.processing.org/u/saltandonion)\
**Replies:** 3\
**Last updated:** [December 18, 2020, 6:28pm UTC](https://discourse.processing.org/t/png-save-and-screen-capture-producing-different-results/26296 "2020-12-18T18:28:10Z")

</div>

has anyone else noticed saving a frame to png alters the colors from processing? i setup a code that just randomly creates 100 squares of random colors. i save the frame as a png and take a screen shot. the colors are s…

---

## [Scaling problem : newbie ahead :)](https://discourse.processing.org/t/scaling-problem-newbie-ahead/26367)

<div class="topic-metadata">

**Author:** [@galleon](https://discourse.processing.org/u/galleon)\
**Replies:** 4\
**Last updated:** [December 18, 2020, 5:05pm UTC](https://discourse.processing.org/t/scaling-problem-newbie-ahead/26367 "2020-12-18T17:05:06Z")

</div>

Hello all, I have started processing this morning even though I have a programming background. I am trying to do a very simple thing a square in a square :slight\_smile: This code is basically doing what I want. ce…

---

## [Odd behavior from curveVertex() - What am I doing wrong?](https://discourse.processing.org/t/odd-behavior-from-curvevertex-what-am-i-doing-wrong/26257)

<div class="topic-metadata">

**Author:** [@brendanbeck](https://discourse.processing.org/u/brendanbeck)\
**Replies:** 1\
**Last updated:** [December 15, 2020, 1:00pm UTC](https://discourse.processing.org/t/odd-behavior-from-curvevertex-what-am-i-doing-wrong/26257 "2020-12-15T13:00:07Z")

</div>

My curveVertex() calls seem to not be drawing points at my intended location. Notice for each iteration of draw(), I call curveVertex(0,0), yet no spline begins from the top left of the entire canvas. Am I using curveVer…

---

## [Making a game in processing - My first project](https://discourse.processing.org/t/making-a-game-in-processing-my-first-project/26216)

<div class="topic-metadata">

**Author:** [@GoWithTheFloe](https://discourse.processing.org/u/GoWithTheFloe)\
**Replies:** 4\
**Last updated:** [December 18, 2020, 2:29pm UTC](https://discourse.processing.org/t/making-a-game-in-processing-my-first-project/26216 "2020-12-18T14:29:23Z")

</div>

Hello guys. I’ve bee fighting a lot now to get the objects spawn right. The game have 3 elements spawning but the problem is to make them spawn after an object is pressed. I tried to use boolean but it won’t work and wi…

[Previous page](https://discourse.processing.org/latest.md?no_subcategories=false&page=271)

[Next page](https://discourse.processing.org/latest.md?no_subcategories=false&page=273)
