'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?
Solution 1:[1]
The best advice I can give you is to get out a piece of paper and a pencil. Draw out the points of a star, and label their X and Y coordinates.
Then you can use something like the line() or beginShape() function to draw that on the screen using code.
You can find more info in the P5.js reference.
Solution 2:[2]
With the new update on p5 you can simply type star(coordinates) and then make the star.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Kevin Workman | 
| Solution 2 | General Grievance | 
