+ 2

Javascript Polygon?

I would like to be able to create shapes(including custom) in JavaScript, but I don't not know how to so this. I have tried Googling but that has been more confusing for me. Can someone demonstrate how a js shape would be made?

22nd Aug 2020, 2:24 AM
Cam UOR
Cam UOR - avatar
2 Respostas
+ 2
Look at this code I made a few weeks ago: https://code.sololearn.com/W5O7AK3ypWhI/?ref=app The function is at JS lines 135 to 147. It takes five parameters: x position, y position, radius/size, how many sides the polygon has, and the rotation. Note that you’ll have to set the fillStyle() first. You’ll need to use the <canvas> element for that. Note: If you’re going to use the function, please put credit in a comment.
22nd Aug 2020, 3:48 AM
Rowsej
Rowsej - avatar
22nd Aug 2020, 3:57 AM
Divya Mohan
Divya Mohan - avatar