mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-27 22:45:25 +00:00
catalogued triangle twist
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user