3,151
questions
0
votes
1
answer
48
views
Dropdown Menu For Images P5js
I am trying to make a drop down menu in p5js that displays images. I keep running into an error with loading images. When I attempted to troubleshoot and loaded an image in another sketch I did not ...
2
votes
1
answer
46
views
Why does p5.js render colors differently when using point() in a loop vs rect()?
I'm working with p5.js to explore color rendering by creating a dynamic color gradient using the point() function. However, I've noticed that when I use point() to draw colors, they appear lighter or ...
0
votes
0
answers
36
views
Toggling audio in React without re-rendering component
I have built a game using React (and Matter JS and p5.js). It mainly has 2 variables, score (increments everytime goal is hit) and timer (decrements every second).
I want music to play in the ...
2
votes
1
answer
58
views
Creating a flat shadow effect from a circle
I've tried a bit of trig and playing with polar to cartesian coordinates but ultimately getting a bit lost on how to achieve an effect in JS. At the moment I've been using p5.js but open to other ...
2
votes
1
answer
74
views
How does p5.js instance mode work where the argument to instantiate the object is a function?
I’m having issues understanding how the P5.js instance mode works. The syntax of creating the object seems so different from anything else I’ve seen.
We’re instantiating a new object with the ‘new p5(...
1
vote
0
answers
29
views
p5 perlin noise field can't get streaking
I know that if you have an opaque background, the previous frame appears. My goal is that the previous dots from previous frames will appear to give a streaking effect. However, setting the background ...
0
votes
0
answers
44
views
Reaction diffusion with shaders on WEBGL
I'm writing a reaction diffusion simulation with p5js based on a video and this tutorial. The code so far is this:
var vertSrc = `
#ifdef GL_ES
precision mediump float;
#endif
attribute vec3 ...
0
votes
0
answers
32
views
I can't make collisions work in p5js with circles
I have followed the instructions of a "TheCodingTrain" tutorial, it describes how to calculate the distance between two circles to emulate collisions. I have a lot more, but this is the code ...
0
votes
1
answer
39
views
I am having trouble figuring out how to round a number to the nearest ones place in p5.js
I have a game I'm making in p5.js and I am having trouble rounding my health varible to the nearest ones place.
I tried using p5.js's round() function (https://p5js.org/reference/p5/round/) and it isn'...
1
vote
0
answers
28
views
p5.js on OpenProcessing, sketch using audio works on desktop but not on mobile
Good afternoon all;
Forgive me as I am very much a 'bodger' when it comes to coding so would appreciate your patience with my noviceness! I have made a rough sketch oppr.org/s/twgjO43M on ...
-3
votes
1
answer
33
views
How to find how many parameters of a conditional statement are met?
I am dealing with an issue where I have to return the number of parameters in a conditional statement that are met. Further, I can only use more conditional statements and the return function.
The ...
0
votes
1
answer
38
views
How to correctly convert images and attach to canvas in p5js?
Currently I'm working on a big project where I'm drawing the shoe model in canvas and using some functions to divide them into segments. Those segments are clickable in order to change the images ...
0
votes
0
answers
35
views
Can't access element's properties using DOM in p5.js
I am trying to expand on The Coding Train's Monty Hall Problem demonstration using p5.js, and I am stuck in trying to implement an automatic mode.
Everything works fine, except that the background of ...
0
votes
1
answer
54
views
Trouble with reading a noise texture in GLSL
I'm writing a Perlin noise terrain generator with p5js, following this tutorial. The app ran poorly so I decided to rewrite it with shaders, something i've never used before. I started by generating a ...
0
votes
0
answers
30
views
in p5 How to change scalling but keep text size in pixel
I change the scaling to print a geometrical shape. Next to it, I print its name. I use the scaling to make the geometrical shape smaller or bigger. I want the text to follow the geometrical shape. ...