Rotate canvas not working in Chrome on Mac

arxdalad

New Member
I've been looking for a long time for the reason why the drawing of a rectangle on the canvas element does not work in google chrome on mac.Here's my code:\[code\]function DrawRectangle(target, ctx, color) { ctx.save(); ctx.translate(target.x, target.y); var angle = target.r / 180 * Math.PI; ctx.rotate(angle); ctx.fillStyle = color; ctx.globalAlpha = 0.40; ctx.fillRect(0, 0, target.w, target.h); ctx.restore();}\[/code\]This works fine in all browsers on windows and mac except for Chrome on Mac.When i comment out the line\[code\]// ctx.rotate(angle);\[/code\]The rectangle is drawn on the canvas. (without rotation of course)Did I do something wrong? Or is this maybe a bug in Chrome?Edit: Probably not a bug in Chrome because this test page works in chrome on Mac: http://www.html5canvastutorials.com/demos/advanced/html5_canvas_transform_rotate/
 
Back
Top