tags:

views:

234

answers:

1

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

A: 

Dug around and found this working solution;

context.scale(1,-1); //flip vertically 
context.translate(0,-height); //move beneath original position

works wonders!

smallmeans