Created
December 8, 2020 23:10
-
-
Save DragoniteSpam/80e18d748b33d24a14c0bc3f8c4b7530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function draw_ngon(x, y, n, length, rot) { | |
draw_primitive_begin(pr_trianglefan); | |
draw_vertex_colour(x, y, c_white, 1); | |
for (var i = 0; i <= n; i++) { | |
var angle = 2 * pi / n * i + rot; | |
draw_vertex_colour(x + length * cos(angle), y - length * sin(angle), make_colour_hsv(255 / (n + 1) * i, 255, 255), 1); | |
} | |
draw_primitive_end(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment