Flip <canvas> (rotate 180deg) after being published on page.

Posted by smallmeans on Stack Overflow See other posts from Stack Overflow or by smallmeans
Published on 2010-04-14T02:13:33Z Indexed on 2010/04/14 2:23 UTC
Read the original article Hit count: 232

Filed under:
|

I'm trying to rotate a canvas element AFTER it's been appended to the DOM. Canvas is 600x50 and this is the code at hand:

var canvas = document.getElementsByTagName('canvas')[2];
var ctx = canvas.getContext('2d');
ctx.translate(300, 25); // rotate @ center

ctx.rotate(angle * Math.PI/180);

which isn't accomplishing the task. Am I missing something?

Thanks

© Stack Overflow or respective owner

Related posts about html5

Related posts about canvas