A function to draw a circle filled with hatched lines using the p5.js library.
hatchedCircle(x,y,radius,step,angle);
Call the function passing the following parameters:
- the x-position of the center of the circle,
- the y-position of the center of the circle,
- the radius of the circle,
- the distance between the hatched lines (step) in pixels,
- the angle of the hatched lines in degrees( from the top of the circle).
- Inside the function
push()
andpop()
are used to stop it interfering with the surrounding p5.js code as it usestranslate()
androtate()
. - remember to use
noFill()
before calling the function otherwise the hatched lines won't be visible. - to use: copy and paste into your code or link to the file in the index.html.