# Coding Questions

**URL:** https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=28

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

**Page:** 29

---

## [Putting Java Sketches online](https://discourse.processing.org/t/putting-java-sketches-online/4571)

<div class="topic-metadata">

**Author:** [@henri](https://discourse.processing.org/u/henri)\
**Replies:** 2\
**Last updated:** [August 20, 2020, 4:41pm UTC](https://discourse.processing.org/t/putting-java-sketches-online/4571 "2020-08-20T16:41:50Z")

</div>

Hi, I have managed to get a few Java sketches embedded on my website but I’m stuck with one and would appreciate any ideas, or things I’m missing about converting to p5.js. So I found this helpful link a few days ago s…

---

## [Code issue\\ A bug that killed me (P5)](https://discourse.processing.org/t/code-issue-a-bug-that-killed-me-p5/23363)

<div class="topic-metadata">

**Author:** [@Royjan](https://discourse.processing.org/u/Royjan)\
**Replies:** 2\
**Last updated:** [August 20, 2020, 5:54am UTC](https://discourse.processing.org/t/code-issue-a-bug-that-killed-me-p5/23363 "2020-08-20T05:54:58Z")

</div>

Hello friends, I created a simple game that has an annoying bug that I can not solve / may be simple for some of you but my brain has become mashed and I can no longer think of a logical solution. So the goal in the g…

---

## [Translate Processing sketch into P5 issue](https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344)

<div class="topic-metadata">

**Author:** [@chanof](https://discourse.processing.org/u/chanof)\
**Replies:** 15\
**Last updated:** [August 19, 2020, 3:40pm UTC](https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344 "2020-08-19T15:40:56Z")

</div>

HI, im trying to translate this processing sketch into P5, P5 is currently unable to give me an error that I can understand. below I posted the original processing sketch, and my wild guess on p5. P5: class CubeClass …

---

## [Drawing inside the box()](https://discourse.processing.org/t/drawing-inside-the-box/23133)

<div class="topic-metadata">

**Author:** [@nokkoran](https://discourse.processing.org/u/nokkoran)\
**Replies:** 3\
**Last updated:** [August 15, 2020, 12:19am UTC](https://discourse.processing.org/t/drawing-inside-the-box/23133 "2020-08-15T00:19:08Z")

</div>

function setup() { createCanvas(400, 400, WEBGL); } function draw() { background(255); rotateX(frameCount \* 0.01); rotateY(frameCount \* 0.01); noStroke(); fill(0); box(150); } I have this code and i want…

---

## [Drawing with custom function on p5.Graphics layer](https://discourse.processing.org/t/drawing-with-custom-function-on-p5-graphics-layer/23268)

<div class="topic-metadata">

**Author:** [@Hapiel](https://discourse.processing.org/u/Hapiel)\
**Replies:** 3\
**Last updated:** [August 15, 2020, 9:36am UTC](https://discourse.processing.org/t/drawing-with-custom-function-on-p5-graphics-layer/23268 "2020-08-15T09:36:44Z")

</div>

Hiya, I wrote a function which draws a shape for me, and now I want to draw that shape onto a p5.Graphics layer. How do I do that? Normally I write myGraphics.ellipse(0,0,10); which works fine, but I can’t write: myGr…

---

## [Is noise too much for mobile devices to handle in p5js?](https://discourse.processing.org/t/is-noise-too-much-for-mobile-devices-to-handle-in-p5js/23048)

<div class="topic-metadata">

**Author:** [@mnoble](https://discourse.processing.org/u/mnoble)\
**Replies:** 12\
**Last updated:** [August 13, 2020, 5:44pm UTC](https://discourse.processing.org/t/is-noise-too-much-for-mobile-devices-to-handle-in-p5js/23048 "2020-08-13T17:44:53Z")

</div>

Hello Forum :slight\_smile: I am working on a visualizer project for mobile devices and I found a great example of clouds using noise on Open Processing. It works good on laptops and crashes on mobile devices. Are noise …

---

## [Selecting from multiple cameras](https://discourse.processing.org/t/selecting-from-multiple-cameras/19679)

<div class="topic-metadata">

**Author:** [@carterjohnson](https://discourse.processing.org/u/carterjohnson)\
**Replies:** 5\
**Last updated:** [August 12, 2020, 8:54pm UTC](https://discourse.processing.org/t/selecting-from-multiple-cameras/19679 "2020-08-12T20:54:07Z")

</div>

Thanks in advance to anyone who might be able to help me out. I want to be able to make a selection as to which camera is utilized by its name or aspect ratio or some other property, and to do so with the code. I know t…

---

## [shadowBlur on circles Particles](https://discourse.processing.org/t/shadowblur-on-circles-particles/23180)

<div class="topic-metadata">

**Author:** [@TienLe](https://discourse.processing.org/u/TienLe)\
**Replies:** 1\
**Last updated:** [August 12, 2020, 7:16am UTC](https://discourse.processing.org/t/shadowblur-on-circles-particles/23180 "2020-08-12T07:16:39Z")

</div>

I have some problems when using shadowBlur, I created particles just like this https://p5js.org/examples/simulate-particles.html But when I using this code to make a shadowBlur on circles, it’s very lag and bad performa…

---

## [Iterate unknown named object properties](https://discourse.processing.org/t/iterate-unknown-named-object-properties/23137)

<div class="topic-metadata">

**Author:** [@ZAF](https://discourse.processing.org/u/ZAF)\
**Replies:** 1\
**Last updated:** [August 9, 2020, 1:39am UTC](https://discourse.processing.org/t/iterate-unknown-named-object-properties/23137 "2020-08-09T01:39:34Z")

</div>

Hi, im working on a function called howMuchOn(users) wich recieves an object filled with objects as the following example shows: let users = { toni: { age: 33, online: true }, emily: { age: 25, online: true }, …

---

## [How to get screen coordinates for "Fit To Screen" function](https://discourse.processing.org/t/how-to-get-screen-coordinates-for-fit-to-screen-function/22514)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 16\
**Last updated:** [August 7, 2020, 7:29pm UTC](https://discourse.processing.org/t/how-to-get-screen-coordinates-for-fit-to-screen-function/22514 "2020-08-07T19:29:13Z")

</div>

I want to make a “Fit to Screen” function if it does not already exist. I need the screen coordinates to find the max width of the image compared to “width”. I found a mention of “frame.getInsets().left”. If this is what…

---

## [Having trouble with a simple drawing program in p5.js](https://discourse.processing.org/t/having-trouble-with-a-simple-drawing-program-in-p5-js/23074)

<div class="topic-metadata">

**Author:** [@alligatorpears](https://discourse.processing.org/u/alligatorpears)\
**Replies:** 5\
**Last updated:** [August 6, 2020, 4:01pm UTC](https://discourse.processing.org/t/having-trouble-with-a-simple-drawing-program-in-p5-js/23074 "2020-08-06T16:01:27Z")

</div>

Okay, so I am working on a very basic drawing program that so far has drawing, erasing, color picking, stroke weight, etc. However, I am now trying to make an eyedropper tool. How I want it to work is: You click on the e…

---

## [I need move the players in board like Monopoly](https://discourse.processing.org/t/i-need-move-the-players-in-board-like-monopoly/23061)

<div class="topic-metadata">

**Author:** [@Xremix31](https://discourse.processing.org/u/Xremix31)\
**Replies:** 3\
**Last updated:** [August 5, 2020, 6:53pm UTC](https://discourse.processing.org/t/i-need-move-the-players-in-board-like-monopoly/23061 "2020-08-05T18:53:14Z")

</div>

Hi i need help for move players in board. I can show players but when move the player i can’t see this player. I use this code for set the player in tile. pl1.setTileCount(2) and i thin this move the player for other ti…

---

## [Drawing points on a circle](https://discourse.processing.org/t/drawing-points-on-a-circle/23046)

<div class="topic-metadata">

**Author:** [@thunderball](https://discourse.processing.org/u/thunderball)\
**Replies:** 2\
**Last updated:** [August 5, 2020, 1:18pm UTC](https://discourse.processing.org/t/drawing-points-on-a-circle/23046 "2020-08-05T13:18:24Z")

</div>

Hi, a bit of a silly question but I am rusty. I have a program that is drawing points around a circle but I want them to draw all at once (without removing the background) – what am I forgetting? let pts = 35; let a = …

---

## [Including P5js in a blog](https://discourse.processing.org/t/including-p5js-in-a-blog/22727)

<div class="topic-metadata">

**Author:** [@misterybodon](https://discourse.processing.org/u/misterybodon)\
**Replies:** 4\
**Last updated:** [August 4, 2020, 8:56pm UTC](https://discourse.processing.org/t/including-p5js-in-a-blog/22727 "2020-08-04T20:56:16Z")

</div>

Hello, I’m including some p5 sketches in a blogpost, but If I’m not mistaken the responsiveness will be an issue, because: we include the sketch through an iframe there is no way to make the canvas size resize nicely f…

---

## [Trying to display image (sprite) on mouseclick](https://discourse.processing.org/t/trying-to-display-image-sprite-on-mouseclick/23031)

<div class="topic-metadata">

**Author:** [@killimon](https://discourse.processing.org/u/killimon)\
**Replies:** 5\
**Last updated:** [August 4, 2020, 6:14pm UTC](https://discourse.processing.org/t/trying-to-display-image-sprite-on-mouseclick/23031 "2020-08-04T18:14:15Z")

</div>

Hi guys, I am new to p5.js and don’t know what I’m doing wrong. I am trying to display a sprite that I have created on a mouseclick. Unfortunately it doesn’t display. This also happens if use a basic image and not an ani…

---

## [p5.Vector returns strange and negative x and y values](https://discourse.processing.org/t/p5-vector-returns-strange-and-negative-x-and-y-values/23035)

<div class="topic-metadata">

**Author:** [@AbrarShahriar](https://discourse.processing.org/u/AbrarShahriar)\
**Replies:** 3\
**Last updated:** [August 4, 2020, 5:11pm UTC](https://discourse.processing.org/t/p5-vector-returns-strange-and-negative-x-and-y-values/23035 "2020-08-04T17:11:48Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I was experimenting with one of Shiffman’s NOC examples. To be specific the steering behavior one. I added a target for my vehicle with the crea…

---

## [Image Circle Distortion in p5js](https://discourse.processing.org/t/image-circle-distortion-in-p5js/22993)

<div class="topic-metadata">

**Author:** [@leejdotjohnson](https://discourse.processing.org/u/leejdotjohnson)\
**Replies:** 3\
**Last updated:** [August 3, 2020, 5:42pm UTC](https://discourse.processing.org/t/image-circle-distortion-in-p5js/22993 "2020-08-03T17:42:12Z")

</div>

I am trying to implement a circle distortion function in p5js. Here is an example of what I want to achieve: Example In the example an original image is distorted into a 2d circle with an inner and outer radius. I hav…

---

## [ADAPTING ELEMENTS to DEVICES ORIENTATION CHANGE](https://discourse.processing.org/t/adapting-elements-to-devices-orientation-change/22877)

<div class="topic-metadata">

**Author:** [@akenaton](https://discourse.processing.org/u/akenaton)\
**Replies:** 0\
**Last updated:** [July 28, 2020, 3:25pm UTC](https://discourse.processing.org/t/adapting-elements-to-devices-orientation-change/22877 "2020-07-28T15:25:46Z")

</div>

in my sketch i create some elements (buttons) and give to them a position according to the windowWidth && windowHeight. As for desktop not any problems. As for phones or tablets it s more difficult but it is possible, kn…

---

## [My .obj failing to work with loadModel() - " Cannot read property 'vertices' of undefined"](https://discourse.processing.org/t/my-obj-failing-to-work-with-loadmodel-cannot-read-property-vertices-of-undefined/22909)

<div class="topic-metadata">

**Author:** [@TinkererDuty](https://discourse.processing.org/u/TinkererDuty)\
**Replies:** 0\
**Last updated:** [July 29, 2020, 3:07pm UTC](https://discourse.processing.org/t/my-obj-failing-to-work-with-loadmodel-cannot-read-property-vertices-of-undefined/22909 "2020-07-29T15:07:06Z")

</div>

Hi all, Apologies if this makes no sense as I’m fairly new to p5. I’m having trouble trying to get my .obj to work with loadModel() in my code. What I’m hoping is to allow the user to select an .obj of their choice an…

---

## [Multiple object intersection and removal](https://discourse.processing.org/t/multiple-object-intersection-and-removal/22900)

<div class="topic-metadata">

**Author:** [@AbrarShahriar](https://discourse.processing.org/u/AbrarShahriar)\
**Replies:** 2\
**Last updated:** [July 29, 2020, 2:38pm UTC](https://discourse.processing.org/t/multiple-object-intersection-and-removal/22900 "2020-07-29T14:38:40Z")

</div>

I am new to the discourse and not quite sure how to use it. But here I am. I am working on a ecosystem project, and I have an animal class with 2 different genders(0 for female, 1 for male). When 2 different genders int…

---

## [Surround video with opaque circle efficiently](https://discourse.processing.org/t/surround-video-with-opaque-circle-efficiently/22884)

<div class="topic-metadata">

**Author:** [@alphydan](https://discourse.processing.org/u/alphydan)\
**Replies:** 1\
**Last updated:** [July 28, 2020, 11:39pm UTC](https://discourse.processing.org/t/surround-video-with-opaque-circle-efficiently/22884 "2020-07-28T23:39:04Z")

</div>

I am trying to have the person in a video appear in the middle of a circle. Like so: Here’s my naive approach. Find the height of the person and the middle of the person with posenet: hPerson = dist(pose.nose.x, po…

---

## [Alpha mask between objects](https://discourse.processing.org/t/alpha-mask-between-objects/22403)

<div class="topic-metadata">

**Author:** [@orgcaos](https://discourse.processing.org/u/orgcaos)\
**Replies:** 6\
**Last updated:** [July 27, 2020, 6:25pm UTC](https://discourse.processing.org/t/alpha-mask-between-objects/22403 "2020-07-27T18:25:49Z")

</div>

Hello guys! I hope you are safe :slight\_smile: I’m trying to hide a part of a shape I did using alpha mask but I have no idea how to achieve it. My current result looks like that: I want the black shape to act l…

---

## [Converting Processing to Processing.js... please help?](https://discourse.processing.org/t/converting-processing-to-processing-js-please-help/22846)

<div class="topic-metadata">

**Author:** [@Quinny](https://discourse.processing.org/u/Quinny)\
**Replies:** 10\
**Last updated:** [July 26, 2020, 4:10pm UTC](https://discourse.processing.org/t/converting-processing-to-processing-js-please-help/22846 "2020-07-26T16:10:06Z")

</div>

Hello, I’m trying to convert a sketch made in Processing.js to standard Processing so I can port it as a canvass, using screen broadcast, onto surfaces in Unity. I’ve made all the obvious changes like var to int etc., …

---

## [Canvas size / dimensions on save](https://discourse.processing.org/t/canvas-size-dimensions-on-save/22829)

<div class="topic-metadata">

**Author:** [@Honkitonkie](https://discourse.processing.org/u/Honkitonkie)\
**Replies:** 3\
**Last updated:** [July 25, 2020, 4:01pm UTC](https://discourse.processing.org/t/canvas-size-dimensions-on-save/22829 "2020-07-25T16:01:37Z")

</div>

Hello, When I create a canvas of 1200\*627 and save it (saveCanvas or manually) the dimensions change to 2400 \* 1254. I believe this didn’t occur before so I figured it must be something I’ve done that triggered this but…

---

## [Click and Drag to Scroll](https://discourse.processing.org/t/click-and-drag-to-scroll/22768)

<div class="topic-metadata">

**Author:** [@Hepyrian](https://discourse.processing.org/u/Hepyrian)\
**Replies:** 1\
**Last updated:** [July 22, 2020, 6:51pm UTC](https://discourse.processing.org/t/click-and-drag-to-scroll/22768 "2020-07-22T18:51:27Z")

</div>

Hey everyone, I’m working on a piece of software that’s mostly being designed for touch screens. You know how on a touch screen you scoll by touching and dragging? I am trying to implement that functionality into my pro…

---

## [Creating a grid on a flat surface (plane or otherwise)](https://discourse.processing.org/t/creating-a-grid-on-a-flat-surface-plane-or-otherwise/22753)

<div class="topic-metadata">

**Author:** [@redthanos](https://discourse.processing.org/u/redthanos)\
**Replies:** 3\
**Last updated:** [July 22, 2020, 7:57am UTC](https://discourse.processing.org/t/creating-a-grid-on-a-flat-surface-plane-or-otherwise/22753 "2020-07-22T07:57:36Z")

</div>

Hi everyone, i am new to processing and so far i’ve found it interesting to use in animating stuff on the web. I’ve come to a point where I want to create a 3D vector, or a surface for testing purposes, however I get a …

---

## [How move player in board](https://discourse.processing.org/t/how-move-player-in-board/22731)

<div class="topic-metadata">

**Author:** [@Xremix31](https://discourse.processing.org/u/Xremix31)\
**Replies:** 3\
**Last updated:** [July 20, 2020, 6:02pm UTC](https://discourse.processing.org/t/how-move-player-in-board/22731 "2020-07-20T18:02:00Z")

</div>

Hello, I’m having trouble making the player move on the board. I already corrected the post and put the functions in correct classes. How do I get the houses id and correct these two mistakes? I tried to declare the id i…

---

## [Calling WebGL functions from p5.js](https://discourse.processing.org/t/calling-webgl-functions-from-p5-js/22714)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 1\
**Last updated:** [July 19, 2020, 4:04am UTC](https://discourse.processing.org/t/calling-webgl-functions-from-p5-js/22714 "2020-07-19T04:04:39Z")

</div>

---

## [Webcam is not working on my mac pro](https://discourse.processing.org/t/webcam-is-not-working-on-my-mac-pro/22705)

<div class="topic-metadata">

**Author:** [@yejincolor](https://discourse.processing.org/u/yejincolor)\
**Replies:** 2\
**Last updated:** [July 19, 2020, 12:52am UTC](https://discourse.processing.org/t/webcam-is-not-working-on-my-mac-pro/22705 "2020-07-19T00:52:53Z")

</div>

In p5js editor, I wanted to test the example called “capture” to turn on my webcam on my mac pro. The code must be correct since I used the example that already existed, but the camera is not turning on and I do not know…

---

## [Designing the input](https://discourse.processing.org/t/designing-the-input/22451)

<div class="topic-metadata">

**Author:** [@ARNAV\_A\_GUPTA](https://discourse.processing.org/u/ARNAV_A_GUPTA)\
**Replies:** 6\
**Last updated:** [July 17, 2020, 12:00am UTC](https://discourse.processing.org/t/designing-the-input/22451 "2020-07-17T00:00:56Z")

</div>

i want to create an input whose width and increases with respect to how much you’ve written and to create another line… Can I do something like this??? I know I can do it for length… just by checking the input.value() …

[Previous page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=27)

[Next page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=29)
