P5.js object not leaving a trail

I have a project in which I’m trying to make a helix effect, where two ellipses rotate around each other, and they leave a trail which keeps going downwards and then disappearing. now the problem is, …

P5.js camera not working with multiple rotation matrices

I’ve been working for some time on making a 3D first person camera in p5.js for games and random projects, but I’ve been having some trouble. For some time now I’ve been using a single y-rotation …

Property ‘noise’ does not exist on type ‘typeof @types/p5/index”‘

I was humming along in a TypeScript Data Viz project and thought I’d use the p5.js noise function to save some time. Instead I’ve encountered a problem that I can’t fully understand. There seems to be …

How can I change the angle of a vector when hitting an obstacle

So, my issue concerns vectors, I don’t know where I’m going with that case. I’m building a pandemic simulation (using Javascript and the library p5.js), and I’m trying to add a lockdown feature. Here …

How can I use p5.js without it polluting the global scope?

I’m trying to convert some code I wrote for processing.js to use p5.js. In the existing code, I create an object with a statement like processing = new Processing(canvas, p => (p.draw = draw_frame))…

Rotation facing mouse not correct with p5 libraries

i am making a javascript shooter game.i want the the player to rotate towards the mouse.it is working, but the rotation was not correct. I tried this with an image, and it works, but with the sprite …

Redraw Canvas via p5 with deleting the old canvas

I want to visualize my sorting algorithms and redraw the created Canvas each time. My Old Canvas keeps all the old values. It just creates a new Canvas and puts it above the old Canvas. But I thought …

how do I create an alternating stripe pattern with different stripe widths in javascript

I am trying to create a stripe pattern in javascript (p5.js), where the odd stripes are one width and the even are another. If they were the same width, my code to create the pattern would be as …

How can I share methods that call P5.js functions between two different sketches/canvases?

Is there a way to share common methods between two different sketches/canvases? It only works if I’m not referencing any P5.js methods. In the example below there are two sketches and each is loaded …

How do I create a random number that remains constant and doesn’t change in Javascript?

I’m trying to have a few circles drawn on the screen that do not move after initialization. Right now it is constantly drawing them to the screen instead of keeping them there. Here’s the code: for (…