Skip to content
Advertisement

Tag: p5.js

404 on page refresh in NextJS with p5.js

I’m using the react-p5 library for generating PerlinNoise wave animation in my about page. When I use the p5 on any page it returns a 404 page, but if click back to the home page and open about.js using the link it will work. After refresh, it won’t work. Everything works if I remove the p5 component from the file.

Randomize assigned colors in an array in p5.js

I have been trying to recreate one of Vera Molnar’s paintings, and to add a twist, I wanted to randomize the colors in the array as I drag my mouse over the canvas. However, I cannot for the life of me figure out how to do this. Below is one of many attempts at this. What could I be doing

Efficiently mask shapes using createGraphics in p5.js

I am trying to create various shapes in p5.js and fill them with specific patterns/drawings. Each shape will have a unique pattern generated using createGraphics. Since my different shapes won’t cover all of my base canvas, I am thinking of creating smaller-sized graphics for my patterns to improve performance. For example, if my base canvas is 1000 * 1000 pixels

Tile drawing is not displaying

I’m working on this code where if you put in certain characters for the map array, the canvas will display the image corresponding to that character. I have an array for all the ground blocks, at the top. Here’s my code so far: However, nothing seems to be drawing to the screen. I believe this might be a problem with

p5.js: Drawing tool doesn’t work well on mobile devices

For a project, I would like to work with this code: I realized that it doesn’t work well on mobile devices. Sometimes nothing draws, sometimes I get some colored dots. It should possible to draw “normally” with the finger. Is there a way to fix that? Would be very thankful for help! <3 Answer This won’t work as a runnable

Cursor trail algorithm for p5.js

I found this little coding exercise on Processing’s website (https://processing.org/examples/storinginput.html) and decided to make a p5.js version of it. The part that I do not understand about this algorithm is how the ellipses drawn (in the trail) shrinks when variable i, which is used as the scale of the ellipse, is increasing. I suspect that it has something to do

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, I cant get the trail to show up. I followed a tutorial by the coding train on making a trail, and while it works

Advertisement