Sunday, March 6, 2011

[JAVASCRIPT/HTML5] Howto equal Microsoft.Matrix filter to canvas rotate?

Is anyone able to help with this universal rotate function (it's for jquery, but this is a javascript thing) : http://pastebin.com/m382b30e

I changed the non IE canvas code so it'll rotate around the image's center (see http://uptowar.com/jquery in firefox). Now I need to change the IE microsoft filter to do the same (see the same url in internet explorer). But, how? There's little understandable documentation for that filter.

From stackoverflow
  • Suppose you have an angle nAngle given in radians, the rotating matrix would then look like:

    var nCos    = Math.cos(nAngle).toFixed(3),
        nSin    = Math.sin(nAngle).toFixed(3);
    
    var sFilter = "progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=" + nCos + ", M12=" + (-nSin) + ", M21=" + nSin + ", M22=" + nCos + ")";
    

    You may also want looking into specification: Matrix Filter

0 comments:

Post a Comment