Um rotieren Canvas 180 Degree


To rotate a canvas at about the midpoint 180 or 90 Degree, can use the following function.

90 = Degree turn to the right

180 Degree = upside

270 Degree / -90 = Degree turn to the left

 

var x = document.createElement("canvas");
 var context = x.getContext("2d");
 rotateCanvas(180, context)

 

rotateCanvas= function(degree, context)
{
    context.translate( canvasWidth, canvasHeight);
    context.rotate(degree* Math.PI / 180);
    context.translate(0, 0);
    return context;
}