# p5.js

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

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

**Page:** 62

---

## [Translate causing error](https://discourse.processing.org/t/translate-causing-error/23833)

<div class="topic-metadata">

**Author:** [@SamuelCobb](https://discourse.processing.org/u/SamuelCobb)\
**Replies:** 7\
**Last updated:** [September 14, 2020, 11:52pm UTC](https://discourse.processing.org/t/translate-causing-error/23833 "2020-09-14T23:52:12Z")

</div>

hey guys, I have a very short piece of code which I am trying to write, but it seems that the translate function is causing some sort of error. anyone know why? function setup() { cnv = createCanvas(400, 400, WEBGL); …

---

## [Variable Font / JavaScript / Generative Type](https://discourse.processing.org/t/variable-font-javascript-generative-type/20510)

<div class="topic-metadata">

**Author:** [@DaniT3K](https://discourse.processing.org/u/DaniT3K)\
**Replies:** 5\
**Last updated:** [September 14, 2020, 5:06pm UTC](https://discourse.processing.org/t/variable-font-javascript-generative-type/20510 "2020-09-14T17:06:07Z")

</div>

Hello guys, im Daniel, a graphic designer from Portugal ending my master degree about manipulation of variable fonts to produce kinetic typography experiments. Im creating this topic because my main ideia is to create a…

---

## [Variable Fonts on p5.js](https://discourse.processing.org/t/variable-fonts-on-p5-js/19775)

<div class="topic-metadata">

**Author:** [@DaniT3K](https://discourse.processing.org/u/DaniT3K)\
**Replies:** 3\
**Last updated:** [September 14, 2020, 4:51pm UTC](https://discourse.processing.org/t/variable-fonts-on-p5-js/19775 "2020-09-14T16:51:15Z")

</div>

Hello guys, I’m Daniel a graphic designer from Portugal ending my master degree! For my thesis im working with variable fonts. Does anyone knows or have a sketch on how to implement variable fonts on p5.js? Im strugglin…

---

## [P5.js loadStrings() error: Fetch API cannot load file](https://discourse.processing.org/t/p5-js-loadstrings-error-fetch-api-cannot-load-file/23842)

<div class="topic-metadata">

**Author:** [@Tsloa](https://discourse.processing.org/u/Tsloa)\
**Replies:** 9\
**Last updated:** [September 14, 2020, 2:13pm UTC](https://discourse.processing.org/t/p5-js-loadstrings-error-fetch-api-cannot-load-file/23842 "2020-09-14T14:13:49Z")

</div>

I am trying to use LoadStrings() in a p5.js and in the console, I get the error “p5.js:60518 Fetch API cannot load file:\[FILENAME\].txt. URL scheme must be “http” or “https” for CORS request.” I googled it and people sai…

---

## [Need help correcting this converted P5.js code](https://discourse.processing.org/t/need-help-correcting-this-converted-p5-js-code/23804)

<div class="topic-metadata">

**Author:** [@coreyep](https://discourse.processing.org/u/coreyep)\
**Replies:** 3\
**Last updated:** [September 13, 2020, 5:52pm UTC](https://discourse.processing.org/t/need-help-correcting-this-converted-p5-js-code/23804 "2020-09-13T17:52:09Z")

</div>

I converted my Java processing code to P5.js, which I pasted below but my notifications box is telling me that I am missing semicolons for “static final let NUM\_LINES = 10;” and all of my “let x\_(let t) {” and “let y\_1(l…

---

## [Video Cropping - Teachable Machine](https://discourse.processing.org/t/video-cropping-teachable-machine/23805)

<div class="topic-metadata">

**Author:** [@ergoego](https://discourse.processing.org/u/ergoego)\
**Replies:** 2\
**Last updated:** [September 12, 2020, 11:37pm UTC](https://discourse.processing.org/t/video-cropping-teachable-machine/23805 "2020-09-12T23:37:00Z")

</div>

So I created a model at https://teachablemachine.withgoogle.com/train/image. I generate the model, get the p5.js code, and it all works great. But there’s just one big problem. I trained all of my data on a cropped vide…

---

## [How to make a start game screen?](https://discourse.processing.org/t/how-to-make-a-start-game-screen/23776)

<div class="topic-metadata">

**Author:** [@spacecad3t](https://discourse.processing.org/u/spacecad3t)\
**Replies:** 7\
**Last updated:** [September 12, 2020, 11:03pm UTC](https://discourse.processing.org/t/how-to-make-a-start-game-screen/23776 "2020-09-12T23:03:33Z")

</div>

Hi, I was wondering if someone could point me in the right direction. I’m making an interactive snake game and I’d like to have a ‘click to start’ screen at the beginning. This is my sketch.js: var screen = 0; var x; v…

---

## [Empty-example/loading sketches/node-server](https://discourse.processing.org/t/empty-example-loading-sketches-node-server/23739)

<div class="topic-metadata">

**Author:** [@brightbeam](https://discourse.processing.org/u/brightbeam)\
**Replies:** 4\
**Last updated:** [September 10, 2020, 4:19am UTC](https://discourse.processing.org/t/empty-example-loading-sketches-node-server/23739 "2020-09-10T04:19:22Z")

</div>

Hi everyone. I just started a book on p5.js and im trying to run the empty-example included with the complete p5.js dowload and can’t seem to get it to appear in the browser. It loads somewhat because the title appears i…

---

## [blendMode in instance mode](https://discourse.processing.org/t/blendmode-in-instance-mode/23657)

<div class="topic-metadata">

**Author:** [@nikodemd](https://discourse.processing.org/u/nikodemd)\
**Replies:** 9\
**Last updated:** [September 9, 2020, 3:36pm UTC](https://discourse.processing.org/t/blendmode-in-instance-mode/23657 "2020-09-09T15:36:04Z")

</div>

Hi guys! I am running into issues while converting p5 global code into instance mode. I am making sliders that control blending of the images using blendMode(SCREEN). In global sketch, all was fine. When I transition to…

---

## [frameCount stopped working for no discernable reason](https://discourse.processing.org/t/framecount-stopped-working-for-no-discernable-reason/23745)

<div class="topic-metadata">

**Author:** [@BSiemens](https://discourse.processing.org/u/BSiemens)\
**Replies:** 3\
**Last updated:** [September 8, 2020, 10:27pm UTC](https://discourse.processing.org/t/framecount-stopped-working-for-no-discernable-reason/23745 "2020-09-08T22:27:02Z")

</div>

Has anyone else noticed this and found a solution?

---

## [Animated gif loading in version 1.0 of p5.js](https://discourse.processing.org/t/animated-gif-loading-in-version-1-0-of-p5-js/23744)

<div class="topic-metadata">

**Author:** [@jgl](https://discourse.processing.org/u/jgl)\
**Replies:** 2\
**Last updated:** [September 8, 2020, 7:26pm UTC](https://discourse.processing.org/t/animated-gif-loading-in-version-1-0-of-p5-js/23744 "2020-09-08T19:26:00Z")

</div>

Hey All, I was poking around in 1.0 of p5.js and saw that gif loading was supposed to be working: https://medium.com/processing-foundation/p5-js-1-0-is-here-b7267140753a So I tried looking in the source for how it wor…

---

## [https://p5js.org/reference/#/p5.Element/position](https://discourse.processing.org/t/https-p5js-org-reference-p5-element-position/23737)

<div class="topic-metadata">

**Author:** [@ats3788](https://discourse.processing.org/u/ats3788)\
**Replies:** 1\
**Last updated:** [September 8, 2020, 1:10pm UTC](https://discourse.processing.org/t/https-p5js-org-reference-p5-element-position/23737 "2020-09-08T13:10:36Z")

</div>

Hello I fiddle with P5 and tried this https://p5js.org/reference/#/p5.Element/positionPreformatted text let cnv = createCanvas(100, 100); // positions canvas 50px to the right and 100px // below upper left corner…

---

## [How to remove an object](https://discourse.processing.org/t/how-to-remove-an-object/23733)

<div class="topic-metadata">

**Author:** [@ats3788](https://discourse.processing.org/u/ats3788)\
**Replies:** 2\
**Last updated:** [September 8, 2020, 8:57am UTC](https://discourse.processing.org/t/how-to-remove-an-object/23733 "2020-09-08T08:57:00Z")

</div>

Hello I create an object like this let balls = \[\]; b = new Ball(random(150, ScreenX) , 0, r, red, green, blue); but how can I free / remove this Object

---

## [Fonts -- Loading Base64 Encoded Fonts](https://discourse.processing.org/t/fonts-loading-base64-encoded-fonts/23721)

<div class="topic-metadata">

**Author:** [@DennisM](https://discourse.processing.org/u/DennisM)\
**Replies:** 2\
**Last updated:** [September 7, 2020, 1:37pm UTC](https://discourse.processing.org/t/fonts-loading-base64-encoded-fonts/23721 "2020-09-07T13:37:36Z")

</div>

Hi, is there, i was wondering if there is any possibility to load base64 encrypted font files. Or to use encrypted fonts through any method. cheers dennis

---

## [Detecting the start of a scroll](https://discourse.processing.org/t/detecting-the-start-of-a-scroll/23681)

<div class="topic-metadata">

**Author:** [@Jithin](https://discourse.processing.org/u/Jithin)\
**Replies:** 1\
**Last updated:** [September 6, 2020, 4:16am UTC](https://discourse.processing.org/t/detecting-the-start-of-a-scroll/23681 "2020-09-06T04:16:46Z")

</div>

Is there any way to detect the start of a scroll in p5? I want just the start of the scroll. The mouseWheel event doesn’t seem to help.

---

## [Smooth() repositioning p5.js sketch unexpectedly](https://discourse.processing.org/t/smooth-repositioning-p5-js-sketch-unexpectedly/23675)

<div class="topic-metadata">

**Author:** [@jimy102](https://discourse.processing.org/u/jimy102)\
**Replies:** 2\
**Last updated:** [September 5, 2020, 1:38am UTC](https://discourse.processing.org/t/smooth-repositioning-p5-js-sketch-unexpectedly/23675 "2020-09-05T01:38:00Z")

</div>

So I’ve been trying to get a bit of an animation going, and it’s basically finished, except for antialiasing. The problem is whenever I try to use smooth(); my entire sketch gets positioned lower on the index.html. I t…

---

## [P5 instance mode with image and sliders](https://discourse.processing.org/t/p5-instance-mode-with-image-and-sliders/23654)

<div class="topic-metadata">

**Author:** [@nikodemd](https://discourse.processing.org/u/nikodemd)\
**Replies:** 1\
**Last updated:** [September 3, 2020, 4:48pm UTC](https://discourse.processing.org/t/p5-instance-mode-with-image-and-sliders/23654 "2020-09-03T16:48:01Z")

</div>

Hi guys! I am trying to convert my p5 code into instance mode, but it does not seem to work. Does anybody have an idea what am I doing wrong? here is the code: let sketch = function(p) { let DAYLIGHT; let canva…

---

## [Creating game dialogue](https://discourse.processing.org/t/creating-game-dialogue/23594)

<div class="topic-metadata">

**Author:** [@fucfucbrain](https://discourse.processing.org/u/fucfucbrain)\
**Replies:** 4\
**Last updated:** [September 1, 2020, 10:08pm UTC](https://discourse.processing.org/t/creating-game-dialogue/23594 "2020-09-01T22:08:49Z")

</div>

Hi I am in the process of developing my first game. It is an adventure platformer comprised of various missions that lead you to the overall objective (growing a flower). I am currently trying to develop a system to imp…

---

## [Is it possible to show p5js program in Google Sites web site?](https://discourse.processing.org/t/is-it-possible-to-show-p5js-program-in-google-sites-web-site/23620)

<div class="topic-metadata">

**Author:** [@kkchau](https://discourse.processing.org/u/kkchau)\
**Replies:** 6\
**Last updated:** [September 2, 2020, 3:23pm UTC](https://discourse.processing.org/t/is-it-possible-to-show-p5js-program-in-google-sites-web-site/23620 "2020-09-02T15:23:13Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I have a web page that is build by google sites, and i want to show some p5js program graphic in it. i have seen people discuss to use iframe t…

---

## [Ml5js posenet single mode still return multiple face key points](https://discourse.processing.org/t/ml5js-posenet-single-mode-still-return-multiple-face-key-points/23636)

<div class="topic-metadata">

**Author:** [@stephanschulz](https://discourse.processing.org/u/stephanschulz)\
**Replies:** 0\
**Last updated:** [September 2, 2020, 3:00pm UTC](https://discourse.processing.org/t/ml5js-posenet-single-mode-still-return-multiple-face-key-points/23636 "2020-09-02T15:00:21Z")

</div>

I have set detectionType: 'single' and feed my video in this way poseNet.singlePose(video); It’s true that only one skeleton get’s detected but when 2 people are present body parts key-points get scattered between these…

---

## [How to create smooth animation for my sketch](https://discourse.processing.org/t/how-to-create-smooth-animation-for-my-sketch/23565)

<div class="topic-metadata">

**Author:** [@bakursky](https://discourse.processing.org/u/bakursky)\
**Replies:** 4\
**Last updated:** [September 2, 2020, 8:53am UTC](https://discourse.processing.org/t/how-to-create-smooth-animation-for-my-sketch/23565 "2020-09-02T08:53:56Z")

</div>

Hey! I have a simple circle array program. var particles = \[\]; function setup() { createCanvas(400, 400); } function draw() { background(220); angleMode(DEGREES); translate(200,200); for (var i = …

---

## [Using pixels array to fill shape](https://discourse.processing.org/t/using-pixels-array-to-fill-shape/23526)

<div class="topic-metadata">

**Author:** [@andypurbrick](https://discourse.processing.org/u/andypurbrick)\
**Replies:** 5\
**Last updated:** [September 1, 2020, 3:33pm UTC](https://discourse.processing.org/t/using-pixels-array-to-fill-shape/23526 "2020-09-01T15:33:49Z")

</div>

Hi, I’m pretty new to p5 and have never used the pixels array before. I’ve read the documentation and watched some videos on the pixels array but I can’t work out how to achieve the specific effect I’m looking for. I wa…

---

## [Text Randomizer](https://discourse.processing.org/t/text-randomizer/23509)

<div class="topic-metadata">

**Author:** [@Rohitsharma](https://discourse.processing.org/u/Rohitsharma)\
**Replies:** 29\
**Last updated:** [August 31, 2020, 8:28pm UTC](https://discourse.processing.org/t/text-randomizer/23509 "2020-08-31T20:28:00Z")

</div>

Hello, I am trying to write a text randomizer. The idea is to put individual letters of ‘ATOMS’ into the grid. There is a specific grid that I have created and I want Individual letters of the word ‘ATOMS’ to sit in ran…

---

## [How to set up a Local Host](https://discourse.processing.org/t/how-to-set-up-a-local-host/23581)

<div class="topic-metadata">

**Author:** [@Khaled](https://discourse.processing.org/u/Khaled)\
**Replies:** 2\
**Last updated:** [August 31, 2020, 7:57pm UTC](https://discourse.processing.org/t/how-to-set-up-a-local-host/23581 "2020-08-31T19:57:16Z")

</div>

Hello, first time posting here… I just started to use p5.js coming from python, and wanted to try something with p5.sound. but I’m having an issue with preload (), it’s not loading the sound file and web page is stuck …

---

## [Loading files (e.g., loadBytes) in p5.js using node.js](https://discourse.processing.org/t/loading-files-e-g-loadbytes-in-p5-js-using-node-js/23560)

<div class="topic-metadata">

**Author:** [@JBall](https://discourse.processing.org/u/JBall)\
**Replies:** 1\
**Last updated:** [August 31, 2020, 5:11pm UTC](https://discourse.processing.org/t/loading-files-e-g-loadbytes-in-p5-js-using-node-js/23560 "2020-08-31T17:11:20Z")

</div>

Hello all, I am working on a basic project where I want to have a webpage available to my group members where they can go to see the current status of some data files that are populated by a separate program and copied …

---

## [How to hide and show player in board?](https://discourse.processing.org/t/how-to-hide-and-show-player-in-board/23582)

<div class="topic-metadata">

**Author:** [@Xremix31](https://discourse.processing.org/u/Xremix31)\
**Replies:** 1\
**Last updated:** [August 31, 2020, 1:01pm UTC](https://discourse.processing.org/t/how-to-hide-and-show-player-in-board/23582 "2020-08-31T13:01:07Z")

</div>

Hi, I have a problems in my game like monopoly. I created the board and the players inside the setup and did the sprite in the draw. The problem is that every time I launch the data, the player is visible in the positi…

---

## [screenPositionFunction not projecting correctly](https://discourse.processing.org/t/screenpositionfunction-not-projecting-correctly/23019)

<div class="topic-metadata">

**Author:** [@CND](https://discourse.processing.org/u/CND)\
**Replies:** 11\
**Last updated:** [August 29, 2020, 8:04pm UTC](https://discourse.processing.org/t/screenpositionfunction-not-projecting-correctly/23019 "2020-08-29T20:04:41Z")

</div>

This is my test of the screenPosition function that is not working correctly for me. I have digitized the 6 faces for a basic block and tried drawing them with world coordinates and then screen coordinates. The screen dr…

---

## [Bug in textBounds method?](https://discourse.processing.org/t/bug-in-textbounds-method/23541)

<div class="topic-metadata">

**Author:** [@mgs](https://discourse.processing.org/u/mgs)\
**Replies:** 0\
**Last updated:** [August 29, 2020, 3:18am UTC](https://discourse.processing.org/t/bug-in-textbounds-method/23541 "2020-08-29T03:18:40Z")

</div>

Hi, Please see this p5.js sketch: https://editor.p5js.org/wimpo/sketches/gSt5JCJLG I have figured out the letter ‘f’ causes the font.textBounds method to render incorrectly when using the IBM Plex font. The top two bo…

---

## [Trying to play one random video after another in one screen](https://discourse.processing.org/t/trying-to-play-one-random-video-after-another-in-one-screen/11418)

<div class="topic-metadata">

**Author:** [@pelinkiliboz](https://discourse.processing.org/u/pelinkiliboz)\
**Replies:** 7\
**Last updated:** [August 27, 2020, 8:13am UTC](https://discourse.processing.org/t/trying-to-play-one-random-video-after-another-in-one-screen/11418 "2020-08-27T08:13:59Z")

</div>

Hello! I’m fairly new to programming and for my graduation project I’m trying to create a sketch on p5js that plays one random video after another from an array of videos. I can’t seem to figure out the way to play the…

---

## [Shows loading when i run index.html on browser](https://discourse.processing.org/t/shows-loading-when-i-run-index-html-on-browser/23485)

<div class="topic-metadata">

**Author:** [@iamgsshetty](https://discourse.processing.org/u/iamgsshetty)\
**Replies:** 2\
**Last updated:** [August 26, 2020, 11:12am UTC](https://discourse.processing.org/t/shows-loading-when-i-run-index-html-on-browser/23485 "2020-08-26T11:12:34Z")

</div>

function setup() { createCanvas(400, 400); video=createCapture(VIDEO); video.hide(); } function draw() { background(220); image(video,0,0); } output:-

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

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