# Coding Questions

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

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

**Page:** 52

---

## [Script error. (:line 0)](https://discourse.processing.org/t/script-error-line-0/4871)

<div class="topic-metadata">

**Author:** [@SebC](https://discourse.processing.org/u/SebC)\
**Replies:** 12\
**Last updated:** [October 26, 2018, 3:11pm UTC](https://discourse.processing.org/t/script-error-line-0/4871 "2018-10-26T15:11:35Z")

</div>

Hi, I’m just beginning with this library and I have trouble to start. When I play my code, I have a "Script error. (:line 0) " message in the console. I identified where the problem happpens in my code but I have no i…

---

## [Need help for a small pong game](https://discourse.processing.org/t/need-help-for-a-small-pong-game/4882)

<div class="topic-metadata">

**Author:** [@Trey](https://discourse.processing.org/u/Trey)\
**Replies:** 3\
**Last updated:** [October 25, 2018, 10:26pm UTC](https://discourse.processing.org/t/need-help-for-a-small-pong-game/4882 "2018-10-25T22:26:03Z")

</div>

I’m trying to make it so that when the main ball goes through an area in the center of the canvas it spawns a several new, smaller balls that go in random directions. All I’ve been able to do is make a single new ball t…

---

## [saveTable creating new file instead of appending existing](https://discourse.processing.org/t/savetable-creating-new-file-instead-of-appending-existing/4858)

<div class="topic-metadata">

**Author:** [@zooto68](https://discourse.processing.org/u/zooto68)\
**Replies:** 1\
**Last updated:** [October 25, 2018, 7:47pm UTC](https://discourse.processing.org/t/savetable-creating-new-file-instead-of-appending-existing/4858 "2018-10-25T19:47:03Z")

</div>

Hi, I am trying to load in a file in my sketch folder using loadTable, add some data to the file and then save it back to the same file. However, the file is being downloaded in the browser to the default browser downlo…

---

## [Combining image with smoke particle code](https://discourse.processing.org/t/combining-image-with-smoke-particle-code/4579)

<div class="topic-metadata">

**Author:** [@jbeck02](https://discourse.processing.org/u/jbeck02)\
**Replies:** 3\
**Last updated:** [October 25, 2018, 6:41pm UTC](https://discourse.processing.org/t/combining-image-with-smoke-particle-code/4579 "2018-10-25T18:41:18Z")

</div>

Hi everyone. Newbie here. I am just trying to combine Dan’s smoke particle code with the image upload (from data folder) code. Have a picture of a friend camping and just want to addd some from the campfire:) Please h…

---

## [Any idea how to make this in processing p5.js?](https://discourse.processing.org/t/any-idea-how-to-make-this-in-processing-p5-js/4838)

<div class="topic-metadata">

**Author:** [@Jarin7](https://discourse.processing.org/u/Jarin7)\
**Replies:** 10\
**Last updated:** [October 25, 2018, 12:57pm UTC](https://discourse.processing.org/t/any-idea-how-to-make-this-in-processing-p5-js/4838 "2018-10-25T12:57:35Z")

</div>

---

## [Measure distance along curves, curvePoint()? in p5.js?](https://discourse.processing.org/t/measure-distance-along-curves-curvepoint-in-p5-js/4583)

<div class="topic-metadata">

**Author:** [@christianbird](https://discourse.processing.org/u/christianbird)\
**Replies:** 4\
**Last updated:** [October 24, 2018, 11:23pm UTC](https://discourse.processing.org/t/measure-distance-along-curves-curvepoint-in-p5-js/4583 "2018-10-24T23:23:27Z")

</div>

Hello! Please forgive me if I have posted this topic in the wrong location. This is my first post, thanks in advance for any pointers or suggestions. I’m hoping to measure along a spline or bezier curve within p5.js -…

---

## [Responsive sketch mouse issue](https://discourse.processing.org/t/responsive-sketch-mouse-issue/4546)

<div class="topic-metadata">

**Author:** [@chanof](https://discourse.processing.org/u/chanof)\
**Replies:** 2\
**Last updated:** [October 24, 2018, 8:13pm UTC](https://discourse.processing.org/t/responsive-sketch-mouse-issue/4546 "2018-10-24T20:13:36Z")

</div>

Hi there i try to write a simple responsive menu just for fun, or perhaps if it is good enough for a site… I understand that to redraw in the correct position a button after browser window resizing i need to declare but…

---

## [P5js // Trying to work out rotation of an object](https://discourse.processing.org/t/p5js-trying-to-work-out-rotation-of-an-object/4774)

<div class="topic-metadata">

**Author:** [@sam.bowman](https://discourse.processing.org/u/sam.bowman)\
**Replies:** 1\
**Last updated:** [October 24, 2018, 8:00pm UTC](https://discourse.processing.org/t/p5js-trying-to-work-out-rotation-of-an-object/4774 "2018-10-24T20:00:37Z")

</div>

Hey, I am trying to make a basic simulation for a drone/quadcopter, with control of each thruster on the drone. The drone itself is a body, with 4 thrusters attached. I am currently working on adjusting the position and…

---

## [Pixels Array, Multiple Images](https://discourse.processing.org/t/pixels-array-multiple-images/4793)

<div class="topic-metadata">

**Author:** [@lizzy](https://discourse.processing.org/u/lizzy)\
**Replies:** 7\
**Last updated:** [October 24, 2018, 6:31pm UTC](https://discourse.processing.org/t/pixels-array-multiple-images/4793 "2018-10-24T18:31:21Z")

</div>

I want to use the pixels array to randomize color in a repeated image. I think I should see three sharks with three random colors, the same random colors as the squares at the top of the canvas. But, the sharks all get t…

---

## [Google Chrome blocks the webcam](https://discourse.processing.org/t/google-chrome-blocks-the-webcam/4691)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 2\
**Last updated:** [October 22, 2018, 5:31pm UTC](https://discourse.processing.org/t/google-chrome-blocks-the-webcam/4691 "2018-10-22T17:31:18Z")

</div>

Hello my friends, I put my algorithm to take photos in my new website, but the same running in Gooogle Chrome d a Dom Exception error, by what I researched google does not allow the webcam to run if the site does not hav…

---

## [How do I keep my rectangles on the grid?](https://discourse.processing.org/t/how-do-i-keep-my-rectangles-on-the-grid/4630)

<div class="topic-metadata">

**Author:** [@tomer1504](https://discourse.processing.org/u/tomer1504)\
**Replies:** 4\
**Last updated:** [October 21, 2018, 6:03pm UTC](https://discourse.processing.org/t/how-do-i-keep-my-rectangles-on-the-grid/4630 "2018-10-21T18:03:15Z")

</div>

Hello! I am making a simple Snake game with p5.js. I drew a grid, and two rectangles (snake and apple). But, I want to keep my rectangles on the grid, so they align with it. How do I do that? Here is my code: let snake;…

---

## [From Graphics to HTML in div](https://discourse.processing.org/t/from-graphics-to-html-in-div/4646)

<div class="topic-metadata">

**Author:** [@Charles\_Tech](https://discourse.processing.org/u/Charles_Tech)\
**Replies:** 10\
**Last updated:** [October 20, 2018, 9:02am UTC](https://discourse.processing.org/t/from-graphics-to-html-in-div/4646 "2018-10-20T09:02:58Z")

</div>

Hi all, I’m in WEBGL mode which doesn’t support image() (in 0.5.16 anyway) - how can I load a graphics into a an html div? JS Fiddle here Thanks, Charles

---

## [Custom shape not filled correctly with WEBGL](https://discourse.processing.org/t/custom-shape-not-filled-correctly-with-webgl/4631)

<div class="topic-metadata">

**Author:** [@UnGast](https://discourse.processing.org/u/UnGast)\
**Replies:** 1\
**Last updated:** [October 19, 2018, 1:38pm UTC](https://discourse.processing.org/t/custom-shape-not-filled-correctly-with-webgl/4631 "2018-10-19T13:38:59Z")

</div>

When executing this in the default canvas mode, the “notch” in the shape is displayed correctly. But in webgl mode the whole shape is filled like a rectangle. Is it not possible to draw such shapes in webgl? https://edi…

---

## [Missing language/ library?](https://discourse.processing.org/t/missing-language-library/4576)

<div class="topic-metadata">

**Author:** [@ricodevs](https://discourse.processing.org/u/ricodevs)\
**Replies:** 2\
**Last updated:** [October 17, 2018, 8:56pm UTC](https://discourse.processing.org/t/missing-language-library/4576 "2018-10-17T20:56:01Z")

</div>

Hey, I tride to copy a code from p5 preferences to make a button. I got some error saying some of the codewords were missing. Im wondering if there is some library or language I’m missing. var button function setup() {…

---

## [\[SOLVED\] Apply a shader to a geometry](https://discourse.processing.org/t/solved-apply-a-shader-to-a-geometry/4556)

<div class="topic-metadata">

**Author:** [@fmichelini](https://discourse.processing.org/u/fmichelini)\
**Replies:** 2\
**Last updated:** [October 17, 2018, 2:44pm UTC](https://discourse.processing.org/t/solved-apply-a-shader-to-a-geometry/4556 "2018-10-17T14:44:29Z")

</div>

I’m currently trying to add a shader to a 3D geometry, but it gets applied to the canvas instead. I can’t understand what I am missing, any help would be very appreciated. Here’s my code: https://codepen.io/kekkorider/…

---

## [Vertex, loop and draw along a vertex path](https://discourse.processing.org/t/vertex-loop-and-draw-along-a-vertex-path/4545)

<div class="topic-metadata">

**Author:** [@greg500](https://discourse.processing.org/u/greg500)\
**Replies:** 5\
**Last updated:** [October 17, 2018, 10:38am UTC](https://discourse.processing.org/t/vertex-loop-and-draw-along-a-vertex-path/4545 "2018-10-17T10:38:46Z")

</div>

Hi, I’m trying to adapt the code which has been written in java by Daniel Shiffman on his youtube channel into P5.js and I’ve met some problems. The loop which I used to draw the shape doesn’t work properly. In object w…

---

## [About taking a photo with the webcam](https://discourse.processing.org/t/about-taking-a-photo-with-the-webcam/3816)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 6\
**Last updated:** [October 16, 2018, 2:19pm UTC](https://discourse.processing.org/t/about-taking-a-photo-with-the-webcam/3816 "2018-10-16T14:19:49Z")

</div>

Hello my friends, I made an algorithm in which I have two buttons, one to take photo and one to save the photo taken. I purposely did that, because I like to complicate things, you understand me, right? haha ha The iss…

---

## [P5 JS random/shuffle pixels](https://discourse.processing.org/t/p5-js-random-shuffle-pixels/4508)

<div class="topic-metadata">

**Author:** [@sanson](https://discourse.processing.org/u/sanson)\
**Replies:** 6\
**Last updated:** [October 15, 2018, 10:09pm UTC](https://discourse.processing.org/t/p5-js-random-shuffle-pixels/4508 "2018-10-15T22:09:13Z")

</div>

Hello, I’m new in P5JS. I’m trying to convert my Processing code to P5JS. The question is this: I made a Processing code that loads all pixels of an image, apprends the colors of that pixels and then shuffle them. Th…

---

## [Help, Just learned this library. Im stuck, project due in two days](https://discourse.processing.org/t/help-just-learned-this-library-im-stuck-project-due-in-two-days/4472)

<div class="topic-metadata">

**Author:** [@TylerD07](https://discourse.processing.org/u/TylerD07)\
**Replies:** 8\
**Last updated:** [October 15, 2018, 5:15pm UTC](https://discourse.processing.org/t/help-just-learned-this-library-im-stuck-project-due-in-two-days/4472 "2018-10-15T17:15:58Z")

</div>

So i recreated a matrix rain background that was on a tutorial given on youtube. I cannot figure out how to get the rain to redraw when the screen resizes. It is fully adaptable if you initially open the screen in full s…

---

## [Terrain.js sketch](https://discourse.processing.org/t/terrain-js-sketch/4457)

<div class="topic-metadata">

**Author:** [@monkstone](https://discourse.processing.org/u/monkstone)\
**Replies:** 6\
**Last updated:** [October 14, 2018, 5:55pm UTC](https://discourse.processing.org/t/terrain-js-sketch/4457 "2018-10-14T17:55:58Z")

</div>

Here I attempt to create terrain as per Shiffman challenge Web Editor Can’t use CLOSE on endShape like in vanilla processing or JRubyArt, adds spurious lines.

---

## [Perspective() and antialias don't seem to get along in p5.js web editor](https://discourse.processing.org/t/perspective-and-antialias-dont-seem-to-get-along-in-p5-js-web-editor/4308)

<div class="topic-metadata">

**Author:** [@cbeg](https://discourse.processing.org/u/cbeg)\
**Replies:** 0\
**Last updated:** [October 10, 2018, 12:40am UTC](https://discourse.processing.org/t/perspective-and-antialias-dont-seem-to-get-along-in-p5-js-web-editor/4308 "2018-10-10T00:40:53Z")

</div>

Hi all, the sketch below works fine in Codepen, but the perspective() function only works as expected in the p5js web editor if I comment out the setAttributes line. Thoughts? function setup() { createCanvas(800, 200,…

---

## [Why is my rect leaving a trail behind it when I move it?](https://discourse.processing.org/t/why-is-my-rect-leaving-a-trail-behind-it-when-i-move-it/4440)

<div class="topic-metadata">

**Author:** [@swood](https://discourse.processing.org/u/swood)\
**Replies:** 1\
**Last updated:** [October 13, 2018, 10:07pm UTC](https://discourse.processing.org/t/why-is-my-rect-leaving-a-trail-behind-it-when-i-move-it/4440 "2018-10-13T22:07:15Z")

</div>

Hi all, new to p5 and am a bit confused. I am trying to make a rectangle move on a horizontal plane. To do this I am adding two vectors when the user presses the left arrow or right arrow. The paddle is moving as inten…

---

## [Instantiate Particle](https://discourse.processing.org/t/instantiate-particle/4407)

<div class="topic-metadata">

**Author:** [@happyPerson](https://discourse.processing.org/u/happyPerson)\
**Replies:** 2\
**Last updated:** [October 13, 2018, 1:08pm UTC](https://discourse.processing.org/t/instantiate-particle/4407 "2018-10-13T13:08:54Z")

</div>

Using ES6 I need to instantiate Particle constructor. Invoking constructor through default export I’m getting an error -\> p.Particle is not a constructor I’ve scaffolded playground – link 'use strict'; import P5 from '…

---

## [P5 wont load on browser because of loading a csv file](https://discourse.processing.org/t/p5-wont-load-on-browser-because-of-loading-a-csv-file/4419)

<div class="topic-metadata">

**Author:** [@briano1905](https://discourse.processing.org/u/briano1905)\
**Replies:** 3\
**Last updated:** [October 13, 2018, 8:03am UTC](https://discourse.processing.org/t/p5-wont-load-on-browser-because-of-loading-a-csv-file/4419 "2018-10-13T08:03:29Z")

</div>

Hello there, So im pretty new to programming and sorry if this might be trivial to you The problem is my p5 sketch won’t load on the browser it is working fine on the web editor I can load my other sketches fine I’v…

---

## [Error when making a class.p5js](https://discourse.processing.org/t/error-when-making-a-class-p5js/4363)

<div class="topic-metadata">

**Author:** [@ricodevs](https://discourse.processing.org/u/ricodevs)\
**Replies:** 4\
**Last updated:** [October 12, 2018, 10:48pm UTC](https://discourse.processing.org/t/error-when-making-a-class-p5js/4363 "2018-10-12T22:48:23Z")

</div>

Im trying to make a class but I’m getting and error: 1: Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode "%cDid you just try to use p5.js’s str() funct…

---

## [Rotating using math constants](https://discourse.processing.org/t/rotating-using-math-constants/4367)

<div class="topic-metadata">

**Author:** [@monnone](https://discourse.processing.org/u/monnone)\
**Replies:** 1\
**Last updated:** [October 12, 2018, 9:29pm UTC](https://discourse.processing.org/t/rotating-using-math-constants/4367 "2018-10-12T21:29:17Z")

</div>

So I’m trying to use the inbuilt constants QUARTER\_PI, HALF\_PI, and PI to make a single, non-animated rotation to render three separate boxes, but for whatever reason only QUARTER\_PI works; using any other constant resul…

---

## [Creategraphics as an image](https://discourse.processing.org/t/creategraphics-as-an-image/4375)

<div class="topic-metadata">

**Author:** [@kristencostello1](https://discourse.processing.org/u/kristencostello1)\
**Replies:** 4\
**Last updated:** [October 12, 2018, 12:19pm UTC](https://discourse.processing.org/t/creategraphics-as-an-image/4375 "2018-10-12T12:19:48Z")

</div>

Hi, I combined a bunch of image files using creategraphics and .image to make a “pgraphics” (or whatever p5 calls a processing pgraphic… maybe it’s called p5.Renderer?) that has all of the images in one pgraphic. I’d lik…

---

## [Error to get data from url json](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335)

<div class="topic-metadata">

**Author:** [@Banjer71](https://discourse.processing.org/u/Banjer71)\
**Replies:** 5\
**Last updated:** [October 11, 2018, 8:28am UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335 "2018-10-11T08:28:21Z")

</div>

Hi I am having a problem to get the jason data from an url. I got this error from chrome dev tool. It seems that everything has to be processed via https and no http. There is a way to bypass it! Thanks Banjer71

---

## [Syntax Error Output](https://discourse.processing.org/t/syntax-error-output/4261)

<div class="topic-metadata">

**Author:** [@Daniel\_Tex](https://discourse.processing.org/u/Daniel_Tex)\
**Replies:** 5\
**Last updated:** [October 10, 2018, 7:17am UTC](https://discourse.processing.org/t/syntax-error-output/4261 "2018-10-10T07:17:43Z")

</div>

I am getting this error “SyntaxError: Expected ; but found {” Is there any way I can fix this error? The error only shows when I save the file.

---

## [p5.Js Web Editor](https://discourse.processing.org/t/p5-js-web-editor/4248)

<div class="topic-metadata">

**Author:** [@Pilou](https://discourse.processing.org/u/Pilou)\
**Replies:** 2\
**Last updated:** [October 8, 2018, 5:50pm UTC](https://discourse.processing.org/t/p5-js-web-editor/4248 "2018-10-08T17:50:22Z")

</div>

Does it possible for a visitor on a web site of a sketch done to input its own image for see a result of a program? If yes, how code that ? Say this one : https://editor.p5js.org/full/BktcoMOcm the code : https://edit…

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

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