Skip to content

Tag: p5.js

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 …

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 sm…