Skip to content
Advertisement

Tag: p5.js

How do I make this array of objects ‘spring’ into random positions on the canvas?

I’m trying to make an array of images ‘spring’ onto the canvas from the bottom of the screen and then land in random positions, like this image here:enter image description here (this is a screenshot of my canvas after you remove the physics) Here is my attempt so far: https://editor.p5js.org/holographicleah/sketches/DUY0EDnqN I like the animation of the spring that i’ve managed,

p5: Using Sine wave in WEBGL to change y-axis

I have some spheres that I want to move straight on the x axis with only their y-axis changing based on the sine wave (you know the up and down yo-yo pattern). It is pretty simple in 2d but for some reason, in WEBGL, the angle changes in the sin function is not working for this.y. Answer You only call

jQuery getScript() and a div element id

I am using jQuery to add a div to a page that I’d want to then use as a location for content produced by another script (in this case ,p5). It will work fine if I assign include a static div with the id=’p5canvas’ but when I use jQuery to add dynamic content (see below), nothing happens and I don’t

incorrect bouncing behaviour in p5js play library

I’m using the play library: https://molleindustria.github.io/p5.play/ I’m doing a simple bouncing balls demo, with one large ball whose mass in play is given by $pi r^2$. The basic physics looks right to me. But after a few seconds, the large ball starts to jump large distances when struck by a small ball. Here’s my complete code (EDIT, also pasted below):

if something == something show something and keep showing it

so when this is true i want to keep the images even when this turns false later Answer I don’t understand why the condition looks like this label==”HowMuchCanYouSee”==true and not just this label==”HowMuchCanYouSee” Anyway you may add a new flag to the story starting with false that will be turned to true the first time your code it’s hit, and

Advertisement