Category "p5.js"

How do I get Intellisense for JavaScript in VS Code to work? (npm installed @types)

I am writing a little web project with p5.js. Basically it is just this right now: <!DOCTYPE html> <html lang="en"> <head> <script src="h

I am trying to add an object to the end of an array inside said object

I have some code that creates a bunch of Creatures(cells) and they move around the screen and eat food. They all have an age variable so once they become a cert

Is there a way to show p5 canvas in on an astro site?

I am trying to get a p5 canvas to work on an astro-generated site. And I am trying to do that by importing a jsx react component. Here is my astro page import S

Drawing a smooth line in p5js

I have a function that I created which draws a line from the coordinates of its first argument to the coordinates of the second argument. The code runs the func

Drawing an irregular circle with an array of points

I'm trying to draw an irregular circles that animates for the first n number of frames in a sketch. What I want is to generate points and then to draw a line fr

Turning a function based sketch object oriented

I am trying to take Dan Shiffman's prime spiral program and make it object oriented. I am putting all variables into the constructor and making the functions in

keyIsPressed to write on canvas where mouse is clicked p5js

I am working on a function which enables users to write onto screen where mouse has been clicked however there are a few problems. Firstly: keyIsPressed is exec

How to convert Khan academy code to p5.js

I'm using the https://editor.p5js.org/Josef37/sketches/RGDv9lHkK for convert to p5.js and I'm still don't know how to convert 100% correct, the picture won't sh

p5js - Radial lines of different lengths not drawing correctly

I'm working on a p5js project, and drawing radial lines with different lengths. I'm using this snippet in a loop to map and draw the lines: var x1 = (this.mapR1

Problem tying a variable to a boolean in P5JS (Simple bouncing ball exercise)

TL;DR Why isn't the ball bouncing off of the edge in the link below? I'm currently going through the CodingTrain P5JS videos. What I'm trying to achieve is a si

Transitioning from one scene to the next with p5.js

I'm currently using p5.js to create an interactive story. My main problem is that I can't seem to figure out how to write the logic for transitioning from the s

Can't rotate loaded SVG in p5js

I'm trying to load an external SVG with I'm using p5js-svg with p5js and for the most part I don't have any issues, but I'm stuck trying to rotate a loaded SVG.

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

p5.js Image Not Showing

So I was making an image editing app with p5.js. I uploaded an image to postimages.org (imgur wasn't working). It actually loads the image (I have seen in netwo

Is there a way to detect collisions between the ball and the lines?

I'm currently working on a little physics simulation, and had some trouble figuring out how to get the ball to collide with the platforms. Here's my code: var a

Cut out a custom shape from an image in P5.js

I am trying to create jigsaw puzzle shapes using P5.js. After creating puzzle shapes, I want to cut areas from main image into pieces. For that I have options o

Typewriter effect P5.JS

js and trying to animate a text for it to look as if it was being typed, but I am stuck with this... var palabra= "Hola!"; = var pos = 0; function setup() {

Looping an entire p5js script

I was wondering if it is possible to run the following code on the p5js web editor or within VS code multiple times and change the parameters a, b, A, B, H from

moving a sketch from draw to setup

Im playing around with the prime spiral code from Dan Shiffman: https://www.youtube.com/watch?v=a35KWEjRvc0&t=716s&ab_channel=TheCodingTrain I need to u

Histogram based on image as vector graphic

I would like to transform histograms based on images to vector graphics. This could be a start: function preload() { img = loadImage("https://upload.wikim