How to rotate a triangle without rotating the entire canvas?
<p>I'm new to working with <code>&lt;canvas&gt;</code> and terrible at maths. I'm drawing a simple equilateral triangle on my canvas with this function that has borrowed code from somebody else (don't hate me):</p>

<pre><code>drawTriangle(PosX, PosY, SideLength, Orientation) {
    context.beginPath();

    var sides = 3;

    var a = ((Math.PI * 2) / sides);

    context.moveTo(PosX + SideLength, PosY);

    for (var i = 1; i &lt; sides + 1; i++) {
        context.lineTo(PosX + SideLength * Math.cos(a*i), PosY + SideLength * Math.sin(a*i));
    }

    context.closePath();

    return true;
}
</code></pre>

<p>The function would only know the centre co-ordinates of the triangle and the orientation to point it at, nothing else.</p>

<p>It currently draws the triangle successfully but "points" east.</p>

<p>How do I rotate the triangle using the <code>Orientation</code> parameter (degrees) without rotating the entire canvas like other answers suggest?</p>