I have an image sprite including 8 frames of my character (game hero) that is turned to right. I want that hero to be turned to left on key hold left. Now it is turned to right all the time. I am drawing the image on 2d canvas context like so:
ctx.translate(x, y);
// TODO - here I need to rotate it in 3d
// ctx.rotate();
ctx.translate(-x,-y);
ctx.drawImage(i, cycle * spriteW, 0, spriteW, spriteH, x, y, spriteW, spriteH);
ctx.restore();
Is it possible to rotate it using 2d context or do I need to change some logic?