# p5.js

**URL:** https://discourse.processing.org/c/p5js/10.md?page=75

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

**Page:** 76

---

## [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…

---

## [FREE book (available soon): Drawing with code](https://discourse.processing.org/t/free-book-available-soon-drawing-with-code/19354)

<div class="topic-metadata">

**Author:** [@codeguppy](https://discourse.processing.org/u/codeguppy)\
**Replies:** 0\
**Last updated:** [April 3, 2020, 12:26am UTC](https://discourse.processing.org/t/free-book-available-soon-drawing-with-code/19354 "2020-04-03T00:26:42Z")

</div>

I start working on a FREE book with type-in mini programs intended for young coders. The book is based of course on p5.js API and is using codeguppy.com - the “no boilerplate” environment for young coders. How is workin…

---

## [Free PDF book: Creative Coding for Kids](https://discourse.processing.org/t/free-pdf-book-creative-coding-for-kids/19353)

<div class="topic-metadata">

**Author:** [@codeguppy](https://discourse.processing.org/u/codeguppy)\
**Replies:** 0\
**Last updated:** [April 3, 2020, 12:17am UTC](https://discourse.processing.org/t/free-pdf-book-creative-coding-for-kids/19353 "2020-04-03T00:17:53Z")

</div>

I just want to share with you the news about a new edition of Creative Coding for Kids book by Tariq Rashid. Tariq is an extraordinary educator with a big passion for writing. He has been nicely enough to share a free v…

---

## [Sprites in the p5 editor](https://discourse.processing.org/t/sprites-in-the-p5-editor/17451)

<div class="topic-metadata">

**Author:** [@shodai](https://discourse.processing.org/u/shodai)\
**Replies:** 6\
**Last updated:** [April 3, 2020, 12:15am UTC](https://discourse.processing.org/t/sprites-in-the-p5-editor/17451 "2020-04-03T00:15:15Z")

</div>

I am a teacher and am using p5js to teach basic coding. However, although there is a lot that can done in the editor, I was wondering if there is a way to use sprites? I have been looking at the p5play library and it see…

---

## [Moving from processing to p5 - for loop and scattering pixels from image](https://discourse.processing.org/t/moving-from-processing-to-p5-for-loop-and-scattering-pixels-from-image/19325)

<div class="topic-metadata">

**Author:** [@ehv](https://discourse.processing.org/u/ehv)\
**Replies:** 2\
**Last updated:** [April 2, 2020, 10:07pm UTC](https://discourse.processing.org/t/moving-from-processing-to-p5-for-loop-and-scattering-pixels-from-image/19325 "2020-04-02T22:07:06Z")

</div>

I’m looking to move my processing sketch into p5 so it can be shared on the web. It runs great in processing - it’s an interactive sketch that takes in mouseX and increases the digital noise of the image by scattering t…

---

## [Separate Files Don't Work?](https://discourse.processing.org/t/separate-files-dont-work/19348)

<div class="topic-metadata">

**Author:** [@DaveDonnie](https://discourse.processing.org/u/DaveDonnie)\
**Replies:** 1\
**Last updated:** [April 2, 2020, 9:30pm UTC](https://discourse.processing.org/t/separate-files-dont-work/19348 "2020-04-02T21:30:56Z")

</div>

I was trying to replicate something from the coding train, and I made a file called block.js which looks like this: class Block { constructor(x,w) { this.x = x; this.y = height - w; this.w = w } show() { f…

---

## [P5() instance inside p5.Vector?](https://discourse.processing.org/t/p5-instance-inside-p5-vector/19330)

<div class="topic-metadata">

**Author:** [@marcg](https://discourse.processing.org/u/marcg)\
**Replies:** 4\
**Last updated:** [April 2, 2020, 7:02pm UTC](https://discourse.processing.org/t/p5-instance-inside-p5-vector/19330 "2020-04-02T19:02:56Z")

</div>

Hi there. Recently I tried optimising a project I have and I noticed something strange. The p5.Vector() object contains an instance of p5()… the whole p5() object Inside the src code I found this p5.Vector = function V…

---

## [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…

---

## [ReverseCatastrophe - interactive poem //time triggered mic-in-recording&playback](https://discourse.processing.org/t/reversecatastrophe-interactive-poem-time-triggered-mic-in-recording-playback/19268)

<div class="topic-metadata">

**Author:** [@p5ooopsi](https://discourse.processing.org/u/p5ooopsi)\
**Replies:** 0\
**Last updated:** [March 31, 2020, 9:52pm UTC](https://discourse.processing.org/t/reversecatastrophe-interactive-poem-time-triggered-mic-in-recording-playback/19268 "2020-03-31T21:52:50Z")

</div>

Reverse catastrophe Times seem to be a catastrophe - but that only depends on how we look at the current situation. I´d like to reverse the ongoing pessimism with an interactive reverse-poem (like this one). I prototyp…

---

## [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…

---

## [Is it unable to define objects using a "class" keyword on the p5.js mode on Processing](https://discourse.processing.org/t/is-it-unable-to-define-objects-using-a-class-keyword-on-the-p5-js-mode-on-processing/18678)

<div class="topic-metadata">

**Author:** [@arigat](https://discourse.processing.org/u/arigat)\
**Replies:** 2\
**Last updated:** [March 30, 2020, 4:09am UTC](https://discourse.processing.org/t/is-it-unable-to-define-objects-using-a-class-keyword-on-the-p5-js-mode-on-processing/18678 "2020-03-30T04:09:33Z")

</div>

I use the p5.js mode on Processing 3.5.4, and run a sample “ex02\_Multiple\_Objects” from a Objects group. I get the following error: SyntaxError: Expected an operand but found class. If I open index.html on a browser (…

---

## [Animated gif don't work with createImage () P5.Image?](https://discourse.processing.org/t/animated-gif-dont-work-with-createimage-p5-image/18913)

<div class="topic-metadata">

**Author:** [@nazimba](https://discourse.processing.org/u/nazimba)\
**Replies:** 4\
**Last updated:** [March 29, 2020, 3:48pm UTC](https://discourse.processing.org/t/animated-gif-dont-work-with-createimage-p5-image/18913 "2020-03-29T15:48:41Z")

</div>

I’m trying to create an animated gif to display within an image created with createImage () but it apparently doesn’t work with the great new gif update made for p5.js? Is this possible? Or am I forgetting something? le…

---

## [GSOC ideasList p5.js-sound](https://discourse.processing.org/t/gsoc-ideaslist-p5-js-sound/18961)

<div class="topic-metadata">

**Author:** [@endurance21](https://discourse.processing.org/u/endurance21)\
**Replies:** 4\
**Last updated:** [March 29, 2020, 3:01pm UTC](https://discourse.processing.org/t/gsoc-ideaslist-p5-js-sound/18961 "2020-03-29T15:01:58Z")

</div>

i have few question regarding this idea , in the Expected outcomes section , the last point that is Tests run on every pull request in a headless browser is it about Travis bot or we have to use Jenkins explicitly…

---

## [Individual fade of two structures](https://discourse.processing.org/t/individual-fade-of-two-structures/18760)

<div class="topic-metadata">

**Author:** [@byxx](https://discourse.processing.org/u/byxx)\
**Replies:** 1\
**Last updated:** [March 28, 2020, 4:44pm UTC](https://discourse.processing.org/t/individual-fade-of-two-structures/18760 "2020-03-28T16:44:00Z")

</div>

Hi there, In the project (link below) I would like to add some functionality: https://editor.p5js.org/byxx/sketches/pGtCNkcq The green and red structure should be able to be faded in and out individually Case1: Durin…

---

## [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…

---

## [Re-scaling image by pixel: why is r NaN?](https://discourse.processing.org/t/re-scaling-image-by-pixel-why-is-r-nan/19008)

<div class="topic-metadata">

**Author:** [@casey123](https://discourse.processing.org/u/casey123)\
**Replies:** 1\
**Last updated:** [March 25, 2020, 9:55pm UTC](https://discourse.processing.org/t/re-scaling-image-by-pixel-why-is-r-nan/19008 "2020-03-25T21:55:53Z")

</div>

I want to eventually re-scale my imported image while skewing it. Right now, I’m trying to get per pixel info but my variable “r” here is undefined in console. What am I missing? Thanks var img; var vScale = 4; functio…

---

## [Pull request review request on P5.js-sound](https://discourse.processing.org/t/pull-request-review-request-on-p5-js-sound/18593)

<div class="topic-metadata">

**Author:** [@endurance21](https://discourse.processing.org/u/endurance21)\
**Replies:** 1\
**Last updated:** [March 25, 2020, 10:13pm UTC](https://discourse.processing.org/t/pull-request-review-request-on-p5-js-sound/18593 "2020-03-25T22:13:40Z")

</div>

some PR’s on p5.js-sound like #420 #419 have not been reviewed for a long time , its hindering the development of p5.js-sound please review them . :smiley: thank you ! :smiley:

---

## [Build error in p5.js grunt script](https://discourse.processing.org/t/build-error-in-p5-js-grunt-script/18833)

<div class="topic-metadata">

**Author:** [@eswaraprasad](https://discourse.processing.org/u/eswaraprasad)\
**Replies:** 1\
**Last updated:** [March 25, 2020, 8:32pm UTC](https://discourse.processing.org/t/build-error-in-p5-js-grunt-script/18833 "2020-03-25T20:32:49Z")

</div>

I get the error when running npm run grunt.

---

## [Export SVG issues with Processing and p5.js](https://discourse.processing.org/t/export-svg-issues-with-processing-and-p5-js/18695)

<div class="topic-metadata">

**Author:** [@plainspace](https://discourse.processing.org/u/plainspace)\
**Replies:** 15\
**Last updated:** [March 25, 2020, 8:15pm UTC](https://discourse.processing.org/t/export-svg-issues-with-processing-and-p5-js/18695 "2020-03-25T20:15:36Z")

</div>

I’m relatively new to Processing and know enough to be dangerous. I want to export an SVG. I’ve been reading here and here and trying to import processing.svg.\*; in my code but I’m getting nothing. I have the latest ver…

---

## [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…

---

## [How to use classes in instance mode?](https://discourse.processing.org/t/how-to-use-classes-in-instance-mode/18807)

<div class="topic-metadata">

**Author:** [@josephcscarpa](https://discourse.processing.org/u/josephcscarpa)\
**Replies:** 2\
**Last updated:** [March 23, 2020, 2:00pm UTC](https://discourse.processing.org/t/how-to-use-classes-in-instance-mode/18807 "2020-03-23T14:00:51Z")

</div>

I have two sketches that I would like to run on a single page and the only way this is possible with instance mode. I am just not sure how to incorporate classes used in those sketches in instance mode. Has anyone done t…

---

## [Error on loading local images](https://discourse.processing.org/t/error-on-loading-local-images/18855)

<div class="topic-metadata">

**Author:** [@ej8000](https://discourse.processing.org/u/ej8000)\
**Replies:** 1\
**Last updated:** [March 21, 2020, 9:13am UTC](https://discourse.processing.org/t/error-on-loading-local-images/18855 "2020-03-21T09:13:25Z")

</div>

I have in setup() img = loadImage(“download.jpg”); and in draw() image(img,0, 0); i,ve got this error(Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///G:/p5/ex1/do…

---

## [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!

[Previous page](https://discourse.processing.org/c/p5js/10.md?page=74)

[Next page](https://discourse.processing.org/c/p5js/10.md?page=76)
