# Coding Questions

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

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

**Page:** 35

---

## [Smoke from Perlin noise](https://discourse.processing.org/t/smoke-from-perlin-noise/19462)

<div class="topic-metadata">

**Author:** [@segu](https://discourse.processing.org/u/segu)\
**Replies:** 9\
**Last updated:** [April 9, 2020, 1:38pm UTC](https://discourse.processing.org/t/smoke-from-perlin-noise/19462 "2020-04-09T13:38:15Z")

</div>

Hi everybody, I recently got mesmerized by this sketch found on openprocessing.org. I wanted to tip my toe into p5 so I decided to try to adapt the code and here is my shot: let x; let t = 0; let w = 255; let m = 0; l…

---

## [Mouse interaction with 3D objects / objects on 3D plane](https://discourse.processing.org/t/mouse-interaction-with-3d-objects-objects-on-3d-plane/19499)

<div class="topic-metadata">

**Author:** [@Furu](https://discourse.processing.org/u/Furu)\
**Replies:** 5\
**Last updated:** [April 7, 2020, 7:16pm UTC](https://discourse.processing.org/t/mouse-interaction-with-3d-objects-objects-on-3d-plane/19499 "2020-04-07T19:16:52Z")

</div>

Hi, I’m looking for a way to interact (preferably mouseOver) with ellipses here: http://dev.furu.studio/sandbox/p5js/ . I tried using libraries from https://p5js.org/libraries/ but they do not work with 3d. I tried usi…

---

## [Recursive Problem](https://discourse.processing.org/t/recursive-problem/19405)

<div class="topic-metadata">

**Author:** [@JudgeJesse](https://discourse.processing.org/u/JudgeJesse)\
**Replies:** 2\
**Last updated:** [April 6, 2020, 1:16pm UTC](https://discourse.processing.org/t/recursive-problem/19405 "2020-04-06T13:16:08Z")

</div>

Howdy! I’m trying to make a Sudoku Solver and I can’t seem to figure out this bug. I’ve got too many console.logs in here but you should be able see what’s happening. I use a recursive function to try all possible number…

---

## [Vertices from model](https://discourse.processing.org/t/vertices-from-model/19449)

<div class="topic-metadata">

**Author:** [@pallavi24](https://discourse.processing.org/u/pallavi24)\
**Replies:** 1\
**Last updated:** [April 6, 2020, 1:00pm UTC](https://discourse.processing.org/t/vertices-from-model/19449 "2020-04-06T13:00:22Z")

</div>

Is there any way to get vertices from a model (an obj uploaded to p5.js)

---

## [Optimising sine wave animation performance](https://discourse.processing.org/t/optimising-sine-wave-animation-performance/19188)

<div class="topic-metadata">

**Author:** [@feyelaf](https://discourse.processing.org/u/feyelaf)\
**Replies:** 1\
**Last updated:** [April 5, 2020, 7:29pm UTC](https://discourse.processing.org/t/optimising-sine-wave-animation-performance/19188 "2020-04-05T19:29:44Z")

</div>

Hi I have generated a sine wave animation from some of the p5 examples files and it is pretty much exactly how I would like it to animate. However I have noticed it does generate quite heavy processor usage. So I am gene…

---

## [blendMode rendering issues p5.js](https://discourse.processing.org/t/blendmode-rendering-issues-p5-js/19179)

<div class="topic-metadata">

**Author:** [@artforart](https://discourse.processing.org/u/artforart)\
**Replies:** 1\
**Last updated:** [April 5, 2020, 6:41pm UTC](https://discourse.processing.org/t/blendmode-rendering-issues-p5-js/19179 "2020-04-05T18:41:32Z")

</div>

I keep running into performance issues trying to visualize some simplex noise – using about 1700 circle objects. Setting the blendMode(MULTIPLY) in the setup function has been producing some laggy results. See this co…

---

## [How to solve problems with CORS?](https://discourse.processing.org/t/how-to-solve-problems-with-cors/16048)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 3\
**Last updated:** [April 4, 2020, 11:26pm UTC](https://discourse.processing.org/t/how-to-solve-problems-with-cors/16048 "2020-04-04T23:26:43Z")

</div>

When you use: loadImage ('urldeoutrohost.jpg', img =\> { image (img, 0.0); }); It ends up giving CORS error if you are not using a CORS extension. I would like to know if there is any way to solve this ?, why didn’…

---

## [Sharing variables between different instance mode sketches](https://discourse.processing.org/t/sharing-variables-between-different-instance-mode-sketches/19264)

<div class="topic-metadata">

**Author:** [@calornorte](https://discourse.processing.org/u/calornorte)\
**Replies:** 2\
**Last updated:** [April 4, 2020, 10:20pm UTC](https://discourse.processing.org/t/sharing-variables-between-different-instance-mode-sketches/19264 "2020-04-04T22:20:23Z")

</div>

or having a global variable that could be accessed by different instance mode sketches. I have been looking around but I don’t seem to understand how to do it, any example that could illuminate me? best!

---

## [I need help making the pictures stay until next is pressed](https://discourse.processing.org/t/i-need-help-making-the-pictures-stay-until-next-is-pressed/19273)

<div class="topic-metadata">

**Author:** [@stacy](https://discourse.processing.org/u/stacy)\
**Replies:** 1\
**Last updated:** [April 3, 2020, 6:26pm UTC](https://discourse.processing.org/t/i-need-help-making-the-pictures-stay-until-next-is-pressed/19273 "2020-04-03T18:26:39Z")

</div>

Can someone please help Heres the code: var drop = \[\]; let images = \["images (9).jpeg","images (10).jpeg", "images (8).jpeg", "images (7).jpeg", "images (5).jpeg", "images (6).jpeg" \]; let current = 1; function setu…

---

## [How to correcly apply SVG filters on the canvas?](https://discourse.processing.org/t/how-to-correcly-apply-svg-filters-on-the-canvas/19347)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 1\
**Last updated:** [April 3, 2020, 5:37pm UTC](https://discourse.processing.org/t/how-to-correcly-apply-svg-filters-on-the-canvas/19347 "2020-04-03T17:37:24Z")

</div>

Hi, I am trying to apply a SVG filter on a sketch by accessing the context of the canvas (ctx = canvas.getContext("2d")) and pasting the following in the index.html file: \<div id="stats"\>\</div\> \<svg xmlns="http://www.…

---

## [Turn line on angle](https://discourse.processing.org/t/turn-line-on-angle/19349)

<div class="topic-metadata">

**Author:** [@yasinyer](https://discourse.processing.org/u/yasinyer)\
**Replies:** 1\
**Last updated:** [April 3, 2020, 2:00am UTC](https://discourse.processing.org/t/turn-line-on-angle/19349 "2020-04-03T02:00:31Z")

</div>

Hi, I’m kinda new here and need a little help! I made a line that moves along the arrrow keys and speeds up when the space bar is pressed. In my code when the line changes its direction it makes a corner (see left), but…

---

## [New and totally stuck on including sketch with WEBGL font into an HTML page](https://discourse.processing.org/t/new-and-totally-stuck-on-including-sketch-with-webgl-font-into-an-html-page/19310)

<div class="topic-metadata">

**Author:** [@melissaUK](https://discourse.processing.org/u/melissaUK)\
**Replies:** 1\
**Last updated:** [April 1, 2020, 9:49pm UTC](https://discourse.processing.org/t/new-and-totally-stuck-on-including-sketch-with-webgl-font-into-an-html-page/19310 "2020-04-01T21:49:11Z")

</div>

I’m so stuck. I have been using the p5.js editor online and I am loving it. But I want to include the sketch in an html page, eventually making it an animated header. So I’m trying to work it out. I’ve downloaded, and sk…

---

## [Instance Mode - calling other sketches](https://discourse.processing.org/t/instance-mode-calling-other-sketches/18893)

<div class="topic-metadata">

**Author:** [@meh](https://discourse.processing.org/u/meh)\
**Replies:** 3\
**Last updated:** [March 24, 2020, 12:29pm UTC](https://discourse.processing.org/t/instance-mode-calling-other-sketches/18893 "2020-03-24T12:29:46Z")

</div>

Hello, I wanted to know if this is possible. I want to be able to call others sketches back and forth. For instance for simplicity I created 2 sketches when i click on Sketch2 it will show that sketch now in this sketc…

---

## [createFolderInput()?](https://discourse.processing.org/t/createfolderinput/19262)

<div class="topic-metadata">

**Author:** [@Odermonicon](https://discourse.processing.org/u/Odermonicon)\
**Replies:** 0\
**Last updated:** [March 31, 2020, 8:52pm UTC](https://discourse.processing.org/t/createfolderinput/19262 "2020-03-31T20:52:09Z")

</div>

p5.js has a function called createFileInput(), is there a way to do a similar thing with folders?

---

## [Question about my line code](https://discourse.processing.org/t/question-about-my-line-code/19211)

<div class="topic-metadata">

**Author:** [@Code\_kover](https://discourse.processing.org/u/Code_kover)\
**Replies:** 2\
**Last updated:** [March 30, 2020, 10:38pm UTC](https://discourse.processing.org/t/question-about-my-line-code/19211 "2020-03-30T22:38:37Z")

</div>

function setup() { createCanvas(400, 400); } function draw() { background(220,220,0); fill(255,100,0); rect(166,57,68,15);//hat noFill(); rect(176,72,48,45);//head circle(186,82,10);//eyes circle(18…

---

## [Perlin 3D noise working correctly?](https://discourse.processing.org/t/perlin-3d-noise-working-correctly/18988)

<div class="topic-metadata">

**Author:** [@Kubi](https://discourse.processing.org/u/Kubi)\
**Replies:** 5\
**Last updated:** [March 28, 2020, 2:39am UTC](https://discourse.processing.org/t/perlin-3d-noise-working-correctly/18988 "2020-03-28T02:39:01Z")

</div>

I am working on a little sketch that uses 3d perlin noise: https://editor.p5js.org/Kubi/sketches/mTEiY6-dR Essentially, it’s just a moving background. I noticed, that there is some kind of rythmic motion going on… Hard…

---

## [Resetting animation](https://discourse.processing.org/t/resetting-animation/18785)

<div class="topic-metadata">

**Author:** [@v177](https://discourse.processing.org/u/v177)\
**Replies:** 1\
**Last updated:** [March 27, 2020, 10:16am UTC](https://discourse.processing.org/t/resetting-animation/18785 "2020-03-27T10:16:36Z")

</div>

Hello, I am new to p5.js. I am trying to reset the animation based on an event. Running into an issue where every tie my label value is 2, it just shows the same animation. function draw() { background(255, 120, 120);…

---

## [Sorting Colors with sortMode errors](https://discourse.processing.org/t/sorting-colors-with-sortmode-errors/18651)

<div class="topic-metadata">

**Author:** [@wendyT](https://discourse.processing.org/u/wendyT)\
**Replies:** 10\
**Last updated:** [March 26, 2020, 11:39pm UTC](https://discourse.processing.org/t/sorting-colors-with-sortmode-errors/18651 "2020-03-26T23:39:11Z")

</div>

I’m playing with examples in the “Generative Design” book - this example builds an array of colors from an image and then sorts them. I get an error message: Uncaught ReferenceError: gd is not defined (sketch: line 69…

---

## [Shouldn't this 3D texture of sheep work on the heart?](https://discourse.processing.org/t/shouldnt-this-3d-texture-of-sheep-work-on-the-heart/19001)

<div class="topic-metadata">

**Author:** [@everythingability](https://discourse.processing.org/u/everythingability)\
**Replies:** 3\
**Last updated:** [March 25, 2020, 5:33pm UTC](https://discourse.processing.org/t/shouldnt-this-3d-texture-of-sheep-work-on-the-heart/19001 "2020-03-25T17:33:13Z")

</div>

https://editor.p5js.org/tom.smith/sketches/JCBP7Qksj I’ve tried all sorts of ways round but can’t get the texture (a .jpg) to work. Thanks Tom

---

## [Click on a point on a sphere](https://discourse.processing.org/t/click-on-a-point-on-a-sphere/18657)

<div class="topic-metadata">

**Author:** [@juxn](https://discourse.processing.org/u/juxn)\
**Replies:** 5\
**Last updated:** [March 25, 2020, 12:44am UTC](https://discourse.processing.org/t/click-on-a-point-on-a-sphere/18657 "2020-03-25T00:44:16Z")

</div>

Hi i’m trying to make a kind of “world” navigation where i have points distributed on a sphere that can be rotated, i’m having trouble to find the way to click on an specific point on the sphere surface, so far i’ve mana…

---

## [FPS drop over time ( fixed )](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982)

<div class="topic-metadata">

**Author:** [@ManuManu](https://discourse.processing.org/u/ManuManu)\
**Replies:** 4\
**Last updated:** [March 24, 2020, 3:58pm UTC](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982 "2020-03-24T15:58:04Z")

</div>

Hey, Im new on P5.js, and just started a simple project. i just start a simple code, but i allready have fps drops over time. When a run the code, it start at 60 FPS, but it drop over time to 20 FPS after 5 mins and k…

---

## [Save poses into data base](https://discourse.processing.org/t/save-poses-into-data-base/18776)

<div class="topic-metadata">

**Author:** [@reut](https://discourse.processing.org/u/reut)\
**Replies:** 4\
**Last updated:** [March 19, 2020, 5:26pm UTC](https://discourse.processing.org/t/save-poses-into-data-base/18776 "2020-03-19T17:26:25Z")

</div>

hi, is there a way that i can save the poses in real-time into a data base? how can i approach to those arrays ? thanks!

---

## [Organising a single canvas-long code in instance mode](https://discourse.processing.org/t/organising-a-single-canvas-long-code-in-instance-mode/18779)

<div class="topic-metadata">

**Author:** [@calornorte](https://discourse.processing.org/u/calornorte)\
**Replies:** 0\
**Last updated:** [March 18, 2020, 11:40pm UTC](https://discourse.processing.org/t/organising-a-single-canvas-long-code-in-instance-mode/18779 "2020-03-18T23:40:57Z")

</div>

I’m writing a very long code for a single canvas in instance mode and it’s getting confusing, specially the draw area. how can I organise an instance mode code in different sketches (for a single canvas) considering its…

---

## [WEBGL cylinder between two points](https://discourse.processing.org/t/webgl-cylinder-between-two-points/13806)

<div class="topic-metadata">

**Author:** [@AshaSato](https://discourse.processing.org/u/AshaSato)\
**Replies:** 9\
**Last updated:** [March 15, 2020, 10:23pm UTC](https://discourse.processing.org/t/webgl-cylinder-between-two-points/13806 "2020-03-15T22:23:07Z")

</div>

Hi there! The 3D primitive cylinder function draws a cylinder from its midpoint. I am trying to write a function that will enable me to draw a cylinder between two specified points. My approach so far has been to find …

---

## [I need help changing values in an array](https://discourse.processing.org/t/i-need-help-changing-values-in-an-array/18586)

<div class="topic-metadata">

**Author:** [@Ricochet1451](https://discourse.processing.org/u/Ricochet1451)\
**Replies:** 2\
**Last updated:** [March 11, 2020, 4:01pm UTC](https://discourse.processing.org/t/i-need-help-changing-values-in-an-array/18586 "2020-03-11T16:01:39Z")

</div>

I am currently trying to make a chess game. But i am having some issues changing values. If you look on line 214 of sketch, i am trying to set the pawn to the upper right to “available”, but it wont let me change the val…

---

## [How to create two canvases to run separate WebGL app](https://discourse.processing.org/t/how-to-create-two-canvases-to-run-separate-webgl-app/18304)

<div class="topic-metadata">

**Author:** [@zyhllr](https://discourse.processing.org/u/zyhllr)\
**Replies:** 2\
**Last updated:** [March 6, 2020, 7:48pm UTC](https://discourse.processing.org/t/how-to-create-two-canvases-to-run-separate-webgl-app/18304 "2020-03-06T19:48:45Z")

</div>

How to create two cnavas to run separate WebGL app

---

## [Text input values don't seem to be working](https://discourse.processing.org/t/text-input-values-dont-seem-to-be-working/18337)

<div class="topic-metadata">

**Author:** [@Pixelfixation](https://discourse.processing.org/u/Pixelfixation)\
**Replies:** 5\
**Last updated:** [March 6, 2020, 6:09pm UTC](https://discourse.processing.org/t/text-input-values-dont-seem-to-be-working/18337 "2020-03-06T18:09:52Z")

</div>

I have this sketch I have been working on. https://editor.p5js.org/pixelfixation/sketches/o8UMGxdk I am working on the input boxes under the sketch. On lines 81-88 i am setting up the inputs and on 118 thru 133 i am wo…

---

## [Click event on 3D primitive](https://discourse.processing.org/t/click-event-on-3d-primitive/18426)

<div class="topic-metadata">

**Author:** [@samWolf](https://discourse.processing.org/u/samWolf)\
**Replies:** 4\
**Last updated:** [March 5, 2020, 6:14pm UTC](https://discourse.processing.org/t/click-event-on-3d-primitive/18426 "2020-03-05T18:14:28Z")

</div>

Hey all, any idea how to fire an event when a 3D primitive is clicked. In my case, I’m trying to click on a rotating box and link to another html page. Please help meeh. let cnv; let brand; let clientH; let clientW; le…

---

## [Reset frameRate()](https://discourse.processing.org/t/reset-framerate/18359)

<div class="topic-metadata">

**Author:** [@Mamboleoo](https://discourse.processing.org/u/Mamboleoo)\
**Replies:** 9\
**Last updated:** [March 5, 2020, 10:04am UTC](https://discourse.processing.org/t/reset-framerate/18359 "2020-03-05T10:04:13Z")

</div>

Hey there, I’m having a demo where I need the frameRate to be set to 5. But later on the demo I need to reset the frameRate to the default one. I don’t want to set a fixed value frameRate(30) as I want my frameRate to…

---

## [Mobile functionality not working](https://discourse.processing.org/t/mobile-functionality-not-working/18362)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 1\
**Last updated:** [March 5, 2020, 9:22am UTC](https://discourse.processing.org/t/mobile-functionality-not-working/18362 "2020-03-05T09:22:19Z")

</div>

Hi all, I’m interested in starting to use the mobile functionality with p5, but when I check the examples on their site: https://p5js.org/examples/mobile-tilted-3d-box.html https://p5js.org/examples/mobile-acceleratio…

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

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