catalogued triangle twist

This commit is contained in:
Sam
2022-03-16 19:33:42 +13:00
parent 70421f763f
commit ec6314dae2
8 changed files with 325 additions and 365 deletions

View File

@@ -28,7 +28,7 @@
render();
render_clear();
draw_triangle(0, 200)
draw_triangle(0, 200, "red");
}, 1000 / fps);
rotation += deg_per_sec / fps; // was = j = angle, now = rotation
@@ -38,13 +38,13 @@
render();
function draw_triangle(ang, radius) {
function draw_triangle(ang, radius, colour) {
ctx.beginPath();
ctx.moveTo(centerX + Math.cos(rad(90 + 120 * 1 + ang)) * radius, centerY + Math.sin(rad(90 + 120 * 1 + ang)) * radius);
ctx.lineTo(centerX + Math.cos(rad(90 + 120 * 2 + ang)) * radius, centerY + Math.sin(rad(90 + 120 * 2 + ang)) * radius);
ctx.lineTo(centerX + Math.cos(rad(90 + 120 * 3 + ang)) * radius, centerY + Math.sin(rad(90 + 120 * 3 + ang)) * radius);
ctx.lineTo(centerX + Math.cos(rad(90 + 120 * 1 + ang)) * radius, centerY + Math.sin(rad(90 + 120 * 1 + ang)) * radius);
ctx.strokeStyle = "red";
ctx.strokeStyle = colour;
ctx.stroke();
}