Skip to content

Tag: p5.js

P5 try to factorize Graphics and Canvas code

I want to factorize code for drawing same thing in a graphics or in the standard canvas. ( In my real program, i want to have autonomous class that draw themselves in some context given at construction time ) I cannot find some equivalent from canvas that can match graphics instructions except line. In the fo…

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

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