# Coding Questions

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

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

**Page:** 125

---

## [How To Draw An Image File As PShapes?](https://discourse.processing.org/t/how-to-draw-an-image-file-as-pshapes/14597)

<div class="topic-metadata">

**Author:** [@XXX](https://discourse.processing.org/u/XXX)\
**Replies:** 9\
**Last updated:** [October 11, 2019, 12:34pm UTC](https://discourse.processing.org/t/how-to-draw-an-image-file-as-pshapes/14597 "2019-10-11T12:34:47Z")

</div>

I would like to draw an image file as PShapes; however, the result is a black canvas. How may I correct this to display the image as PShapes? // Global Variables. PImage img; // Setup. void setup() { // Size of c…

---

## [Sketch path is not set](https://discourse.processing.org/t/sketch-path-is-not-set/2279)

<div class="topic-metadata">

**Author:** [@Rfblock](https://discourse.processing.org/u/Rfblock)\
**Replies:** 5\
**Last updated:** [October 11, 2019, 4:49am UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279 "2019-10-11T04:49:04Z")

</div>

I’m using the Yahoo Weather Library GitHub - delvedor/YahooWeatherProcessing: Yahoo Weather library for Processing however I get an error whenever i try to create a weather object. My code: import processing.serial…

---

## [Keyboard controls for multiplayer games](https://discourse.processing.org/t/keyboard-controls-for-multiplayer-games/14580)

<div class="topic-metadata">

**Author:** [@KowtowToMao](https://discourse.processing.org/u/KowtowToMao)\
**Replies:** 2\
**Last updated:** [October 11, 2019, 12:27am UTC](https://discourse.processing.org/t/keyboard-controls-for-multiplayer-games/14580 "2019-10-11T00:27:19Z")

</div>

I’m trying to make a variant of pong, as well as a tanks game, but I can’t find a good way to make multiplayer work. Advice? Current method in the pong variant is shown below, but it has trouble taking multiple inputs at…

---

## [Can someone help explain this to me?](https://discourse.processing.org/t/can-someone-help-explain-this-to-me/14563)

<div class="topic-metadata">

**Author:** [@isaacpowwow](https://discourse.processing.org/u/isaacpowwow)\
**Replies:** 1\
**Last updated:** [October 10, 2019, 2:12am UTC](https://discourse.processing.org/t/can-someone-help-explain-this-to-me/14563 "2019-10-10T02:12:54Z")

</div>

void draw(){ stroke(8,65,92); float steps29 = 1026.4 ; int distance29 = 670 ; int floors = 48; float pointAngle = 360.0/floors; int radius = 670; strokeWeight(1.5); for (float angle = 0; angle \< 360.0; angle = ang…

---

## ["Reset" blur filter](https://discourse.processing.org/t/reset-blur-filter/14501)

<div class="topic-metadata">

**Author:** [@kirillg](https://discourse.processing.org/u/kirillg)\
**Replies:** 2\
**Last updated:** [October 9, 2019, 9:34pm UTC](https://discourse.processing.org/t/reset-blur-filter/14501 "2019-10-09T21:34:33Z")

</div>

My very first steps with Processing, and I couldn’t find the answer after Googling it for some time. size(640, 360); background(204, 153, 0); smooth(); background(0); noStroke(); fill(255,0,0); ellipse(100,100,12,12);…

---

## [Mouse Press Redraw Loop](https://discourse.processing.org/t/mouse-press-redraw-loop/14555)

<div class="topic-metadata">

**Author:** [@Killerherts](https://discourse.processing.org/u/Killerherts)\
**Replies:** 5\
**Last updated:** [October 9, 2019, 7:30pm UTC](https://discourse.processing.org/t/mouse-press-redraw-loop/14555 "2019-10-09T19:30:31Z")

</div>

Thanks for taking the time to look at this, I am a beginner working on a racing game for a final project. My goal is to have the race start after a mouse or key press I was able to achieve this but my object jumps to th…

---

## [Cannot center rectangle](https://discourse.processing.org/t/cannot-center-rectangle/14543)

<div class="topic-metadata">

**Author:** [@organelle](https://discourse.processing.org/u/organelle)\
**Replies:** 3\
**Last updated:** [October 9, 2019, 10:37am UTC](https://discourse.processing.org/t/cannot-center-rectangle/14543 "2019-10-09T10:37:48Z")

</div>

The rectMode(CENTER) cannot center my rectangle in my canvas. How do I fix this?

---

## [Bezier. Solving X,Y](https://discourse.processing.org/t/bezier-solving-x-y/14492)

<div class="topic-metadata">

**Author:** [@edward](https://discourse.processing.org/u/edward)\
**Replies:** 17\
**Last updated:** [October 9, 2019, 10:10am UTC](https://discourse.processing.org/t/bezier-solving-x-y/14492 "2019-10-09T10:10:37Z")

</div>

Hello friends, I’ve been trying to find the Y coordinates of a Bezier Curve given X. I’ve been fairly successful getting approximate values by putting in an array lots of x values corresponding to “t” using the bezier…

---

## [How to export frames from processing](https://discourse.processing.org/t/how-to-export-frames-from-processing/14494)

<div class="topic-metadata">

**Author:** [@Malvan](https://discourse.processing.org/u/Malvan)\
**Replies:** 2\
**Last updated:** [October 8, 2019, 10:51am UTC](https://discourse.processing.org/t/how-to-export-frames-from-processing/14494 "2019-10-08T10:51:50Z")

</div>

Hello there! I got a problem with the following code: PGraphics pg; float fontSize; int cols = 30; int rows = 30; float zoff = 0; float xoffsp = 0.2; float yoffsp = 0.2; float zoffsp = 0.05; float sizes; floa…

---

## [PShader as background](https://discourse.processing.org/t/pshader-as-background/14495)

<div class="topic-metadata">

**Author:** [@rojele](https://discourse.processing.org/u/rojele)\
**Replies:** 2\
**Last updated:** [October 8, 2019, 7:58am UTC](https://discourse.processing.org/t/pshader-as-background/14495 "2019-10-08T07:58:42Z")

</div>

Hi, everyone, and thanks in advance for any help. In order to achieve this, I’m trying actually to apply the PShader to a PGraphics object, and then pass this PGraphics as an argument for the background. When I use the…

---

## [Avoiding randomness in my sketch](https://discourse.processing.org/t/avoiding-randomness-in-my-sketch/14287)

<div class="topic-metadata">

**Author:** [@JoseBri93](https://discourse.processing.org/u/JoseBri93)\
**Replies:** 4\
**Last updated:** [October 7, 2019, 8:31pm UTC](https://discourse.processing.org/t/avoiding-randomness-in-my-sketch/14287 "2019-10-07T20:31:39Z")

</div>

Hi!, i’m creating this sketch where bouncing balls go all over the display. It’s working fine however i want to know is there are other options to work instead of randomness to get diferrent organic ways for my objetcs t…

---

## [Not so random Render Glitch](https://discourse.processing.org/t/not-so-random-render-glitch/14448)

<div class="topic-metadata">

**Author:** [@Coppice](https://discourse.processing.org/u/Coppice)\
**Replies:** 5\
**Last updated:** [October 7, 2019, 4:33pm UTC](https://discourse.processing.org/t/not-so-random-render-glitch/14448 "2019-10-07T16:33:04Z")

</div>

I’ve been trying to recreate Flappy Bird using Processing within Java. Whenever I try to add spikes to it, it always will mess up with the sizes after the first 3 pairs of spikes (seems to be after spikeCount+1 pairs) an…

---

## [Blend Mode - Poster Recreation](https://discourse.processing.org/t/blend-mode-poster-recreation/14403)

<div class="topic-metadata">

**Author:** [@tylerowens](https://discourse.processing.org/u/tylerowens)\
**Replies:** 8\
**Last updated:** [October 7, 2019, 3:58pm UTC](https://discourse.processing.org/t/blend-mode-poster-recreation/14403 "2019-10-07T15:58:21Z")

</div>

Hello all, I have made a poster in adobe illustrator which I want to bring to life a little in processing. I want to be able to use the mouse to place circles onto the poster to sort of have a punching a hole through…

---

## [How to make appear image at random position](https://discourse.processing.org/t/how-to-make-appear-image-at-random-position/14372)

<div class="topic-metadata">

**Author:** [@Anael](https://discourse.processing.org/u/Anael)\
**Replies:** 4\
**Last updated:** [October 7, 2019, 12:06pm UTC](https://discourse.processing.org/t/how-to-make-appear-image-at-random-position/14372 "2019-10-07T12:06:55Z")

</div>

Hello, I’m a graphic design student. For a poster project, i must create an image made of several fake ads appearing randomly on the screen like pop-up. The idea was to load about 10 images and make them appear randomly …

---

## [Recording into PDF is stopped at specific frame count](https://discourse.processing.org/t/recording-into-pdf-is-stopped-at-specific-frame-count/14404)

<div class="topic-metadata">

**Author:** [@QTR](https://discourse.processing.org/u/QTR)\
**Replies:** 9\
**Last updated:** [October 7, 2019, 11:58am UTC](https://discourse.processing.org/t/recording-into-pdf-is-stopped-at-specific-frame-count/14404 "2019-10-07T11:58:44Z")

</div>

Hello all. I am trying to solove this problem almost 1.5 day… but not solved yet… If there is someone who has any knowledges, please share the solution. Problem Recording into PDF always stops at specific frame count…

---

## [Tangent of curvevertex](https://discourse.processing.org/t/tangent-of-curvevertex/13988)

<div class="topic-metadata">

**Author:** [@arcadeperfect](https://discourse.processing.org/u/arcadeperfect)\
**Replies:** 2\
**Last updated:** [October 7, 2019, 2:48am UTC](https://discourse.processing.org/t/tangent-of-curvevertex/13988 "2019-10-07T02:48:11Z")

</div>

Hello! Is there a way to get the normal or tangent of a vertex in a line drawn with curveVertex()? I have found curveTangent() and bezierTangent() but I don’t see a way to do it with a curveVertex shape. Thanks!

---

## [Rugged graph while plotting output of data](https://discourse.processing.org/t/rugged-graph-while-plotting-output-of-data/14426)

<div class="topic-metadata">

**Author:** [@Jufu](https://discourse.processing.org/u/Jufu)\
**Replies:** 8\
**Last updated:** [October 7, 2019, 1:18am UTC](https://discourse.processing.org/t/rugged-graph-while-plotting-output-of-data/14426 "2019-10-07T01:18:27Z")

</div>

Hi, I am currently struggling with a seldom behaviour. I want to plot the mouse position starting from the left side of the window. Ones it arrived on the right side, it should stay there: ArrayList\<Integer\> y = new Ar…

---

## [Creating inscribed circle & polygon loop](https://discourse.processing.org/t/creating-inscribed-circle-polygon-loop/14379)

<div class="topic-metadata">

**Author:** [@fhop](https://discourse.processing.org/u/fhop)\
**Replies:** 4\
**Last updated:** [October 6, 2019, 8:33am UTC](https://discourse.processing.org/t/creating-inscribed-circle-polygon-loop/14379 "2019-10-06T08:33:11Z")

</div>

Hi I would like to create a loop with red circles and blue polygons but when I do my loop only the circles in the center are red the rest are blue. I know I need to put the ellipse & polygon together in a loop but have …

---

## [Identifying and smoothing out peaks in an array](https://discourse.processing.org/t/identifying-and-smoothing-out-peaks-in-an-array/14331)

<div class="topic-metadata">

**Author:** [@edward](https://discourse.processing.org/u/edward)\
**Replies:** 6\
**Last updated:** [October 6, 2019, 3:48am UTC](https://discourse.processing.org/t/identifying-and-smoothing-out-peaks-in-an-array/14331 "2019-10-06T03:48:24Z")

</div>

Good evening, Is there a simple way to detect and smooth local peak or peaks in a long array and create a new array with the new value/s, but keeping the same order as the original array? A simplified example of what …

---

## [Multiple Sine Waves](https://discourse.processing.org/t/multiple-sine-waves/14332)

<div class="topic-metadata">

**Author:** [@paz](https://discourse.processing.org/u/paz)\
**Replies:** 6\
**Last updated:** [October 5, 2019, 9:14pm UTC](https://discourse.processing.org/t/multiple-sine-waves/14332 "2019-10-05T21:14:13Z")

</div>

Hi, Im working a variation of the Sine Wave example for a class, and im curious as to how I would be able to make parallel sine waves (add more) AND/OR make these waves diagonal (from top left to right bottom for exampl…

---

## [keyPressed doesn't work](https://discourse.processing.org/t/keypressed-doesnt-work/14406)

<div class="topic-metadata">

**Author:** [@raminl](https://discourse.processing.org/u/raminl)\
**Replies:** 5\
**Last updated:** [October 4, 2019, 8:54pm UTC](https://discourse.processing.org/t/keypressed-doesnt-work/14406 "2019-10-04T20:54:21Z")

</div>

So I’m working on a display full of triangles. I want to use keyPressed to get random colors for each triangle after I press a key, but unfortunately it doesn’t work (not even when I put it in the void draw). Does anyone…

---

## [Animating image tiles from the top to the bottom](https://discourse.processing.org/t/animating-image-tiles-from-the-top-to-the-bottom/14375)

<div class="topic-metadata">

**Author:** [@dmcsocial](https://discourse.processing.org/u/dmcsocial)\
**Replies:** 3\
**Last updated:** [October 5, 2019, 6:25pm UTC](https://discourse.processing.org/t/animating-image-tiles-from-the-top-to-the-bottom/14375 "2019-10-05T18:25:04Z")

</div>

Hi all, I am new to Processing. I would like to implement an animation, in which an image is built from the bottom tile by tile. I have a 1920x1080 pixels input image and I divided it in tiles (20 tiles per row and 20 …

---

## [Animating a rectangle](https://discourse.processing.org/t/animating-a-rectangle/14428)

<div class="topic-metadata">

**Author:** [@publicClassYoda](https://discourse.processing.org/u/publicClassYoda)\
**Replies:** 2\
**Last updated:** [October 5, 2019, 10:30am UTC](https://discourse.processing.org/t/animating-a-rectangle/14428 "2019-10-05T10:30:36Z")

</div>

Hey everyone! I’m new to processing and learning how to play around with figures. Right now I’m trying to animate the movement of a rectangle. My idea is that the rectangle should move from current position to the clicke…

---

## [Designated 'zones' for bezier arguments](https://discourse.processing.org/t/designated-zones-for-bezier-arguments/14432)

<div class="topic-metadata">

**Author:** [@hahayes](https://discourse.processing.org/u/hahayes)\
**Replies:** 2\
**Last updated:** [October 5, 2019, 1:44am UTC](https://discourse.processing.org/t/designated-zones-for-bezier-arguments/14432 "2019-10-05T01:44:45Z")

</div>

I am trying to make a 3d project that has some bezier curves ‘spewing’ out of the center of the entire project. I want to restrict the arguments to their own ‘zones’, and by that I mean that I want to keep the arguments …

---

## [Problem with Coding Train 9.4](https://discourse.processing.org/t/problem-with-coding-train-9-4/14437)

<div class="topic-metadata">

**Author:** [@redisred](https://discourse.processing.org/u/redisred)\
**Replies:** 1\
**Last updated:** [October 5, 2019, 12:46am UTC](https://discourse.processing.org/t/problem-with-coding-train-9-4/14437 "2019-10-05T00:46:23Z")

</div>

I’m trying to implement Daniel’s example of the bubbles array and I can’t for the life of me figure out why it’s not working. I should be getting 3 ascending bubbles, but I’m only getting 1, which I suspect might be all …

---

## [Need random colors to cycle](https://discourse.processing.org/t/need-random-colors-to-cycle/14431)

<div class="topic-metadata">

**Author:** [@DonnieBrasco](https://discourse.processing.org/u/DonnieBrasco)\
**Replies:** 4\
**Last updated:** [October 4, 2019, 11:39pm UTC](https://discourse.processing.org/t/need-random-colors-to-cycle/14431 "2019-10-04T23:39:29Z")

</div>

Hello, I’m really new to this and having a hard time figure out how to make my colors cycle, or blink with random values if you will. They should change at a rate of 5 frames per second, which I think I’ve got right, bu…

---

## [Use loadimage() with base64-encoded PNG.](https://discourse.processing.org/t/use-loadimage-with-base64-encoded-png/5897)

<div class="topic-metadata">

**Author:** [@RecursiveCursive](https://discourse.processing.org/u/RecursiveCursive)\
**Replies:** 5\
**Last updated:** [October 4, 2019, 3:37pm UTC](https://discourse.processing.org/t/use-loadimage-with-base64-encoded-png/5897 "2019-10-04T15:37:50Z")

</div>

Hello everyone, I am trying to load an image from a base64-encoded string with loadImage like this: loadimage(“data:image/png;base64,iVBORw0KGgoA…”), but it is not working (I cut the base64 string short in this post for…

---

## [How to disable sleep in MacOS while program is running?](https://discourse.processing.org/t/how-to-disable-sleep-in-macos-while-program-is-running/14384)

<div class="topic-metadata">

**Author:** [@spy](https://discourse.processing.org/u/spy)\
**Replies:** 3\
**Last updated:** [October 3, 2019, 6:45am UTC](https://discourse.processing.org/t/how-to-disable-sleep-in-macos-while-program-is-running/14384 "2019-10-03T06:45:16Z")

</div>

I created a digital full screen Clock in Processing. I also created a executable file to run it directly via double click. My OS is MacOS High Sierra. When I run it, my laptop goes to sleep after some time. I want to dis…

---

## [How to figure out which object is closest to a moving origin point](https://discourse.processing.org/t/how-to-figure-out-which-object-is-closest-to-a-moving-origin-point/14298)

<div class="topic-metadata">

**Author:** [@cryptacritic](https://discourse.processing.org/u/cryptacritic)\
**Replies:** 2\
**Last updated:** [October 3, 2019, 6:43am UTC](https://discourse.processing.org/t/how-to-figure-out-which-object-is-closest-to-a-moving-origin-point/14298 "2019-10-03T06:43:29Z")

</div>

Let’s say I’m building a project. Just picture Galaga in your head. The ship you play as shoots missiles. What I’m trying to do here is to program the missiles to fly toward the nearest enemy ship along the x axis (y axi…

---

## [Analogue Clock Second hand Sweep not Tick](https://discourse.processing.org/t/analogue-clock-second-hand-sweep-not-tick/2331)

<div class="topic-metadata">

**Author:** [@yorkie](https://discourse.processing.org/u/yorkie)\
**Replies:** 18\
**Last updated:** [October 3, 2019, 2:36am UTC](https://discourse.processing.org/t/analogue-clock-second-hand-sweep-not-tick/2331 "2019-10-03T02:36:01Z")

</div>

Hi All, I’m busting my brains with this one. I’ve taken the very simple clock sketch from the examples, but instead of drawing the lines I’m using images of clock hands. I currently have my clock working perfectly, ho…

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

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