Skip to content

Tag: p5.js

How to draw a star in P5.js?

I’m trying to make a class “star” with a method inside of it that, at given coordinates and size, draws a star. Something like rect() or ellipse() functions. How can make it? Answer Have a look at this example. It contains a function that can render a star with specified position, radii, and number of points.

p5.js how to freeze canvas?

I try to do something like that : But i want to “freeze” this canvas, so if i load the page i will have 30 rect() at a random height between 30 and 120. Answer One option would be to use noLoop() method inside setup function that will stop draw method loop. Note that with using noLoop and loop methods,