Flip a sprite in canvas
问题 I'm using canvas to display some sprites, and I need to flip one horizontally (so it faces left or right). I can't see any method to do that with drawImage , however. Here's my relevant code: this.idleSprite = new Image(); this.idleSprite.src = "/game/images/idleSprite.png"; this.idleSprite.frameWidth = 28; this.idleSprite.frameHeight = 40; this.idleSprite.frames = 12; this.idleSprite.frameCount = 0; this.draw = function() { if(this.state == "idle") { c.drawImage(this.idleSprite, this