# Coding Questions

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

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

**Page:** 49

---

## [Issue with loadJSON](https://discourse.processing.org/t/issue-with-loadjson/7682)

<div class="topic-metadata">

**Author:** [@aliser](https://discourse.processing.org/u/aliser)\
**Replies:** 3\
**Last updated:** [January 21, 2019, 7:21am UTC](https://discourse.processing.org/t/issue-with-loadjson/7682 "2019-01-21T07:21:20Z")

</div>

How to use it for example with wikipedia api? On the request loadJSON("https://en.wikipedia.org/w/api.php?action=opensearch&search=unicorn, gotData, 'jsonp') I get a response in the form Uncaught (in promise) TypeErro…

---

## [How can the following example be fully written out?](https://discourse.processing.org/t/how-can-the-following-example-be-fully-written-out/7707)

<div class="topic-metadata">

**Author:** [@anon98404100](https://discourse.processing.org/u/anon98404100)\
**Replies:** 3\
**Last updated:** [January 21, 2019, 7:18pm UTC](https://discourse.processing.org/t/how-can-the-following-example-be-fully-written-out/7707 "2019-01-21T19:18:04Z")

</div>

Slight heads-up: The following code was code from earlier in the day and doesn’t work properly, however, there is a small piece of code in there I would like to get some explanation of. Also sorry if the question is kind…

---

## [Can't use line() and loadPixels()](https://discourse.processing.org/t/cant-use-line-and-loadpixels/7620)

<div class="topic-metadata">

**Author:** [@NirDafnai](https://discourse.processing.org/u/NirDafnai)\
**Replies:** 5\
**Last updated:** [January 19, 2019, 5:16pm UTC](https://discourse.processing.org/t/cant-use-line-and-loadpixels/7620 "2019-01-19T17:16:44Z")

</div>

function setup() { let c = createCanvas(600, 600); c.parent('canvasParent'); pixelDensity(1); background(255); loadPixels(); } function mouseDragged() { if(mouseButton == LEFT) { strokeWeight(30); stroke(200,…

---

## [video.loadPixels() does not seem to work](https://discourse.processing.org/t/video-loadpixels-does-not-seem-to-work/7225)

<div class="topic-metadata">

**Author:** [@rjsan](https://discourse.processing.org/u/rjsan)\
**Replies:** 3\
**Last updated:** [January 19, 2019, 4:37pm UTC](https://discourse.processing.org/t/video-loadpixels-does-not-seem-to-work/7225 "2019-01-19T16:37:20Z")

</div>

Hi all! I did a lot of code dabbling on this video capture tutorial sometime around 2017 : https://www.youtube.com/watch?v=rNqaw8LT2ZU using p5js version v0.5.11 . All seem to work even around early 2018 but when i rev…

---

## [Sliders in For Loops](https://discourse.processing.org/t/sliders-in-for-loops/7629)

<div class="topic-metadata">

**Author:** [@PringleCanMan](https://discourse.processing.org/u/PringleCanMan)\
**Replies:** 1\
**Last updated:** [January 18, 2019, 11:08pm UTC](https://discourse.processing.org/t/sliders-in-for-loops/7629 "2019-01-18T23:08:28Z")

</div>

Hello, I am currently working on a small idea here. It involves ellipses that move across the canvas and are put in an array. A constructor function makes the ellipses with random x, y, and speed. I am trying to adjust t…

---

## [How to make objects interact-able?](https://discourse.processing.org/t/how-to-make-objects-interact-able/7574)

<div class="topic-metadata">

**Author:** [@Trey](https://discourse.processing.org/u/Trey)\
**Replies:** 1\
**Last updated:** [January 17, 2019, 5:25pm UTC](https://discourse.processing.org/t/how-to-make-objects-interact-able/7574 "2019-01-17T17:25:20Z")

</div>

So I’m making a escape room style game for a school class but i have no real idea how to make it work properly. I have a ton of classes for different objects that i can place in different parts of the room, but i need t…

---

## [Need to connect IP cam with p5.js](https://discourse.processing.org/t/need-to-connect-ip-cam-with-p5-js/7587)

<div class="topic-metadata">

**Author:** [@Cheshta](https://discourse.processing.org/u/Cheshta)\
**Replies:** 0\
**Last updated:** [January 17, 2019, 10:20am UTC](https://discourse.processing.org/t/need-to-connect-ip-cam-with-p5-js/7587 "2019-01-17T10:20:42Z")

</div>

Hi everyone. I’m trying to connect the IP camera instead of droidcam/webcam in sketch.js (posenet-webcam) How can I use the same ?

---

## [JSON - generating a random value from a certain section with mousePressed()](https://discourse.processing.org/t/json-generating-a-random-value-from-a-certain-section-with-mousepressed/7558)

<div class="topic-metadata">

**Author:** [@anon98404100](https://discourse.processing.org/u/anon98404100)\
**Replies:** 4\
**Last updated:** [January 16, 2019, 11:53am UTC](https://discourse.processing.org/t/json-generating-a-random-value-from-a-certain-section-with-mousepressed/7558 "2019-01-16T11:53:53Z")

</div>

Working with JSON files - I have to recall a certain value with mousePressed() in a specific category. In my code you have the following code : var chuckData; function setup () { createCanvas (displayWidth, 500); …

---

## [Custom fonts slowing down my program](https://discourse.processing.org/t/custom-fonts-slowing-down-my-program/7081)

<div class="topic-metadata">

**Author:** [@Kazuya\_Yoshimisu](https://discourse.processing.org/u/Kazuya_Yoshimisu)\
**Replies:** 4\
**Last updated:** [January 15, 2019, 7:57pm UTC](https://discourse.processing.org/t/custom-fonts-slowing-down-my-program/7081 "2019-01-15T19:57:05Z")

</div>

Hello everyone, So I’m making a project in p5.js which aim to reproduce the Matrix rain code effect. It ran pretty smooth until I decided to load a custom font. When I did, my framerate dropped considerably. And it’s …

---

## [Platformer game screen is constantly moving down](https://discourse.processing.org/t/platformer-game-screen-is-constantly-moving-down/7548)

<div class="topic-metadata">

**Author:** [@Timpupk](https://discourse.processing.org/u/Timpupk)\
**Replies:** 2\
**Last updated:** [January 15, 2019, 6:44pm UTC](https://discourse.processing.org/t/platformer-game-screen-is-constantly-moving-down/7548 "2019-01-15T18:44:19Z")

</div>

The screen is constantly moving down anybody see any way to fix it? https://editor.p5js.org/Timpupk/sketches/Hy1vHJFy4

---

## [Can we use image instead of video in createCapture() to add Images in dataset](https://discourse.processing.org/t/can-we-use-image-instead-of-video-in-createcapture-to-add-images-in-dataset/7515)

<div class="topic-metadata">

**Author:** [@ankit](https://discourse.processing.org/u/ankit)\
**Replies:** 0\
**Last updated:** [January 14, 2019, 6:03pm UTC](https://discourse.processing.org/t/can-we-use-image-instead-of-video-in-createcapture-to-add-images-in-dataset/7515 "2019-01-14T18:03:23Z")

</div>

Hi, We are using FeatureExtraction to get classification and regression since it using video = createCapture(VIDEO); so can we use images in place of video to add our images in the dataset and also want to train that i…

---

## [Trying to create a jumping character](https://discourse.processing.org/t/trying-to-create-a-jumping-character/7448)

<div class="topic-metadata">

**Author:** [@jadenfigger](https://discourse.processing.org/u/jadenfigger)\
**Replies:** 2\
**Last updated:** [January 13, 2019, 4:49pm UTC](https://discourse.processing.org/t/trying-to-create-a-jumping-character/7448 "2019-01-13T16:49:12Z")

</div>

I’m trying to create a character that jumps when ever i press the up arrow. let r = 20; let x = 200; let y = 380; let speed = 8; let gravity = 0.2; function setup() { createCanvas(400, 400); } function draw() { ba…

---

## [P5.js: Save only part of the canvas](https://discourse.processing.org/t/p5-js-save-only-part-of-the-canvas/7286)

<div class="topic-metadata">

**Author:** [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Replies:** 4\
**Last updated:** [January 9, 2019, 7:53pm UTC](https://discourse.processing.org/t/p5-js-save-only-part-of-the-canvas/7286 "2019-01-09T19:53:15Z")

</div>

How can I save/download only a part of the canvas (save a cropped part of the whole image)? e.g. function setup() { createCanvas(windowWidth, windowHeight); background(255); } function draw() { ellipse(mouseX, mou…

---

## [Why is the above grammar not showing up?](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341)

<div class="topic-metadata">

**Author:** [@alk5603](https://discourse.processing.org/u/alk5603)\
**Replies:** 4\
**Last updated:** [January 9, 2019, 12:43pm UTC](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341 "2019-01-09T12:43:49Z")

</div>

var mass = \[\]; var positionX = \[\]; var positionY = \[\]; var velocityX = \[\]; var velocityY = \[\]; ///////////////////////////////////////////////////////////////////////////////////////////////////// function setup() …

---

## [How do I change the color of the rectangle after hitting a bounce?](https://discourse.processing.org/t/how-do-i-change-the-color-of-the-rectangle-after-hitting-a-bounce/7335)

<div class="topic-metadata">

**Author:** [@anon98404100](https://discourse.processing.org/u/anon98404100)\
**Replies:** 2\
**Last updated:** [January 9, 2019, 7:26am UTC](https://discourse.processing.org/t/how-do-i-change-the-color-of-the-rectangle-after-hitting-a-bounce/7335 "2019-01-09T07:26:01Z")

</div>

For a school project I am learning P5.Js at the moment. one of my assignments is that I have a moving rectangle. It bounces of the walls from the xPosition and yPosition, so it can go any direction. My assignment is tha…

---

## [Trouble you greatly help thanks](https://discourse.processing.org/t/trouble-you-greatly-help-thanks/7342)

<div class="topic-metadata">

**Author:** [@alk5603](https://discourse.processing.org/u/alk5603)\
**Replies:** 1\
**Last updated:** [January 9, 2019, 3:47am UTC](https://discourse.processing.org/t/trouble-you-greatly-help-thanks/7342 "2019-01-09T03:47:10Z")

</div>

Randomly generate 5,000 balls with a diameter of 10, random colors, and bouncing within the canvas. When the mouse clicks, a fixed ball (which does not run) is generated at the position where the mouse clicks. Whe…

---

## [Building a Walker in p5](https://discourse.processing.org/t/building-a-walker-in-p5/7336)

<div class="topic-metadata">

**Author:** [@pers0n](https://discourse.processing.org/u/pers0n)\
**Replies:** 1\
**Last updated:** [January 9, 2019, 1:17am UTC](https://discourse.processing.org/t/building-a-walker-in-p5/7336 "2019-01-09T01:17:30Z")

</div>

I’m having trouble writing a Walker in P5, mostly due to Classes/Objects. I’ve tried it 2 ways, but am not having any luck :frowning: https://editor.p5js.org/pers0n/sketches/HyFphoMzV https://editor.p5js.org/pers0n/ske…

---

## [noFill() not working in processing 3.4](https://discourse.processing.org/t/nofill-not-working-in-processing-3-4/7275)

<div class="topic-metadata">

**Author:** [@formap](https://discourse.processing.org/u/formap)\
**Replies:** 6\
**Last updated:** [January 8, 2019, 4:13pm UTC](https://discourse.processing.org/t/nofill-not-working-in-processing-3-4/7275 "2019-01-08T16:13:44Z")

</div>

I’m testing the example found in this link where I create either a rectangle or a box and try to draw it without a fill but it doesn’t seem to be working for me. Instead of transparent, I see it filled up with colours. I…

---

## [P5 game ball bouncing bug](https://discourse.processing.org/t/p5-game-ball-bouncing-bug/6768)

<div class="topic-metadata">

**Author:** [@avafgrey](https://discourse.processing.org/u/avafgrey)\
**Replies:** 2\
**Last updated:** [January 7, 2019, 9:23pm UTC](https://discourse.processing.org/t/p5-game-ball-bouncing-bug/6768 "2019-01-07T21:23:35Z")

</div>

I am trying to make a game with a ball that bounces off the platforms, but every once in a while the ball falls through the platform and I can’t figure out when or why. https://github.com/lizzybrooks/Bouncingball/blob/m…

---

## [Recursive Backtracking](https://discourse.processing.org/t/recursive-backtracking/6914)

<div class="topic-metadata">

**Author:** [@SineadF](https://discourse.processing.org/u/SineadF)\
**Replies:** 3\
**Last updated:** [January 6, 2019, 11:14pm UTC](https://discourse.processing.org/t/recursive-backtracking/6914 "2019-01-06T23:14:36Z")

</div>

Hello, I’ve been watching the Coding Trains Maze Generation videos (https://www.youtube.com/watch?v=\_p5IH0L63wo) that uses the depth-first search and recursive backtracking method to generate a maze. The video covers th…

---

## [Insert sketch in tumblr](https://discourse.processing.org/t/insert-sketch-in-tumblr/7252)

<div class="topic-metadata">

**Author:** [@ihi](https://discourse.processing.org/u/ihi)\
**Replies:** 2\
**Last updated:** [January 6, 2019, 9:46pm UTC](https://discourse.processing.org/t/insert-sketch-in-tumblr/7252 "2019-01-06T21:46:34Z")

</div>

Hi ! I am a beginner on processing. I have managed to do what I wanted, I have a code that works. But I can not put this code on Tumblr. I read a lot of pages about it but I can not do it. I do not understand if I have …

---

## [3D Mode(WEBGL) Changes the colors of mysketch](https://discourse.processing.org/t/3d-mode-webgl-changes-the-colors-of-mysketch/6199)

<div class="topic-metadata">

**Author:** [@gio](https://discourse.processing.org/u/gio)\
**Replies:** 5\
**Last updated:** [January 6, 2019, 6:08am UTC](https://discourse.processing.org/t/3d-mode-webgl-changes-the-colors-of-mysketch/6199 "2019-01-06T06:08:08Z")

</div>

Hi, I just changed a 2d sketch to be 3D with the WEBGL option. I wanted to shift perpective, and that works perfectly, but somehow the colors are now different. Im guessing now its using some kind of 3d lamp, but i wan…

---

## [Processing code to p5.js](https://discourse.processing.org/t/processing-code-to-p5-js/7173)

<div class="topic-metadata">

**Author:** [@Lillbre](https://discourse.processing.org/u/Lillbre)\
**Replies:** 5\
**Last updated:** [January 5, 2019, 6:14pm UTC](https://discourse.processing.org/t/processing-code-to-p5-js/7173 "2019-01-05T18:14:21Z")

</div>

I wonder how to translate this PImage magnified, normal; to p5.js. My guess is let magnified= new p5.Image(); let normal= new p5.Image(); but that didn’t make it work. I am trying to do make a magnifying glass like…

---

## [\[SOLVED\] Undefined Error](https://discourse.processing.org/t/solved-undefined-error/7176)

<div class="topic-metadata">

**Author:** [@Quillbert1](https://discourse.processing.org/u/Quillbert1)\
**Replies:** 4\
**Last updated:** [January 4, 2019, 7:09pm UTC](https://discourse.processing.org/t/solved-undefined-error/7176 "2019-01-04T19:09:39Z")

</div>

I am having an issue with some code. Whenever I run it, i get an error saying Population is undefined in setup. The code is at the github link below.

---

## [Need help regarding UV mapping of Octahedron](https://discourse.processing.org/t/need-help-regarding-uv-mapping-of-octahedron/7114)

<div class="topic-metadata">

**Author:** [@Sudev](https://discourse.processing.org/u/Sudev)\
**Replies:** 4\
**Last updated:** [January 4, 2019, 4:53pm UTC](https://discourse.processing.org/t/need-help-regarding-uv-mapping-of-octahedron/7114 "2019-01-04T16:53:41Z")

</div>

I need some help with UV mapping an octahedron. Here’s my code : let w = 0; let h = 0; let th = 400; beginShape(); vertex(w - side, h - side, 0, 0, 1); vertex(w + side, h - side, 0, 0, 0); vertex(w, …

---

## [Basic httpPost() Image/Data to Server](https://discourse.processing.org/t/basic-httppost-image-data-to-server/7040)

<div class="topic-metadata">

**Author:** [@lightning](https://discourse.processing.org/u/lightning)\
**Replies:** 1\
**Last updated:** [January 1, 2019, 2:27am UTC](https://discourse.processing.org/t/basic-httppost-image-data-to-server/7040 "2019-01-01T02:27:14Z")

</div>

Ive been pulling my hair out for weeks trying to accomplish something that seemed pretty straight forward… I want to make a javascript plug in with p5.js that resembles a t-shirt designer. I want a user to be able to up…

---

## [Temporary layers / Multiple canvases using p5](https://discourse.processing.org/t/temporary-layers-multiple-canvases-using-p5/7016)

<div class="topic-metadata">

**Author:** [@davidjj](https://discourse.processing.org/u/davidjj)\
**Replies:** 2\
**Last updated:** [December 31, 2018, 11:46pm UTC](https://discourse.processing.org/t/temporary-layers-multiple-canvases-using-p5/7016 "2018-12-31T23:46:31Z")

</div>

Hey - I’m an experienced javascript developer and have done a bit with plain javascript and html5 canvas. What I’m doing is something similar to the spirograph example on the examples page - the difference being that I …

---

## [TypeError: np\_d.changed is not a function](https://discourse.processing.org/t/typeerror-np-d-changed-is-not-a-function/7056)

<div class="topic-metadata">

**Author:** [@Strex](https://discourse.processing.org/u/Strex)\
**Replies:** 1\
**Last updated:** [December 31, 2018, 5:48pm UTC](https://discourse.processing.org/t/typeerror-np-d-changed-is-not-a-function/7056 "2018-12-31T17:48:02Z")

</div>

i have this error and i don;t know how fix it. code: var np; var r = 300; var t; var alp; var point1 = \[\]; function setup() { createCanvas(windowWidth, windowHeight); np\_d = document.getElementById("points")…

---

## [Beta testers required](https://discourse.processing.org/t/beta-testers-required/6983)

<div class="topic-metadata">

**Author:** [@Pr0tonX](https://discourse.processing.org/u/Pr0tonX)\
**Replies:** 7\
**Last updated:** [December 31, 2018, 3:55pm UTC](https://discourse.processing.org/t/beta-testers-required/6983 "2018-12-31T15:55:05Z")

</div>

Hieveryone, I’ve almost done my project, wich is a remake of the concept of jonobr1 and lullatone : a visualization of sounds, wich are corresponding to one letter of the keyboard. See https://www.patatap.com/ for the o…

---

## [Writeln in p5.js](https://discourse.processing.org/t/writeln-in-p5-js/7010)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 9\
**Last updated:** [December 30, 2018, 2:15am UTC](https://discourse.processing.org/t/writeln-in-p5-js/7010 "2018-12-30T02:15:05Z")

</div>

Hello my friends, I would like to save a txt file with the broken lines, but I am not finding a command similar to println to write to the .txt file The only one I found was the write.print which unfortunately does not …

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

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