<
DIV
STYLE
="position:absolute;zoom:0.5;background:black;width:400;height:300;top:33;left:55"
>
<
DIV
ID
="oDiv"
STYLE
=" background-color: lightblue; padding:5;width:300;height:300;"
>
SOME TEXT
<
BR
/>
SOME TEXT
<
BR
/>
SOME TEXT
<
BR
/>
SOME TEXT
<
BR
/>
</
DIV
>
</
DIV
>
<
SCRIPT
>
...
// oObj input requires that a matrix filter be applied. //deg input defines the requested angle of rotation. var deg2radians = Math.PI * 2 / 360 ; function MatrixFilter(obj) ... { if ( ! obj.filters) return ; // alert(obj.filters.item(0)); var Matrix; for (p in obj.filters) ... { if (p == " DXImageTransform.Microsoft.Matrix " )Matrix = obj.filters[ " DXImageTransform.Microsoft.Matrix " ]; } if ( ! Matrix) ... { obj.style.filter += " progid:DXImageTransform.Microsoft.Matrix() " ; } Matrix= obj.filters[ " DXImageTransform.Microsoft.Matrix " ]; this .equal = function (Matrix2D_x) ... { if (Matrix2D_x.M11)Matrix.M11 = Matrix2D_x.M11; if (Matrix2D_x.M12)Matrix.M12 = Matrix2D_x.M12; if (Matrix2D_x.M21)Matrix.M21 = Matrix2D_x.M21; if (Matrix2D_x.M22)Matrix.M22 = Matrix2D_x.M22; } if (arguments[ 1 ]) this .equal(arguments[ 1 ]); this .Rotate = function (deg) ... { rad = deg * deg2radians; costheta = Math.cos(rad); sintheta = Math.sin(rad); var d = new Matrix2D(costheta, - sintheta,sintheta,costheta); this .equal(Matrix2D.Mul(Matrix,d)); } this .RotateTo = function (deg) ... { rad = deg * deg2radians; costheta = Math.cos(rad); sintheta = Math.sin(rad); var d = new Matrix2D(costheta, - sintheta,sintheta,costheta); this .equal(d); } this .MoveTo = function (sx,sy) ... { this .(Matrix2D.Mul(Matrix,d)); } this .toMatrix2D = function () ... { return new Matrix2D(Matrix.M11,Matrix.M12,Matrix.M21,Matrix.M22); } this .ZoomBy = function (sx,sy) ... { var d = new Matrix2D(sx, 0 , 0 ,sy); this .equal(Matrix2D.Mul(Matrix,d)); } this .toString = function () ... { return "" + Matrix.M11 + " " + Matrix.M12 + " " + Matrix.M21 + " " + Matrix.M22 + " " } // Matrix.SizingMethod='clip to original'; // this.fnSetRotation(30); // alert(Matrix.M11); // alert(obj.filters["DXImageTransform.Microsoft.Matrix"]); } function Matrix2D() ... { this .M11 = arguments[ 0 ] || 1 ; this .M12 = arguments[ 1 ] || 0 ; this .M21 = arguments[ 2 ] || 0 ; this .M22 = arguments[ 3 ] || 1 ; this .Mul_Matrix2D = function (Matrix2D_b) ... { var r = new Matrix2D(); r = Matrix2D.Mul( this ,Matrix2D_b); return r; } this .toString = function () ... { return "" + this .M11 + " " + this .M12 + " " + this .M21 + " " + this .M22 + " " } } Matrix2D.Mul= function (Matrix2D_a,Matrix2D_b) ... { var r = new Matrix2D(); r.M11 = Matrix2D_a.M11 * Matrix2D_b.M11 + Matrix2D_a.M12 * Matrix2D_b.M21; r.M12 = Matrix2D_a.M11 * Matrix2D_b.M12 + Matrix2D_a.M12 * Matrix2D_b.M22; r.M21 = Matrix2D_a.M21 * Matrix2D_b.M11 + Matrix2D_a.M22 * Matrix2D_b.M21; r.M22 = Matrix2D_a.M21 * Matrix2D_b.M12 + Matrix2D_a.M22 * Matrix2D_b.M22; return r; } var mf = new MatrixFilter(oDiv); setInterval( " mf.Rotate(1) " , 30 ); // mf.ZoomBy(1.5,1.5); //mf.ZoomBy(1.5,1.5); //alert(mf.toMatrix2D()); // alert(Matrix2D.Mul(m2d1,m2d2)); //fnSetRotation(oDiv.filters.item(0),30);
</
script
>
如果你想完全看明白它,你可能需要一点计算机图形学的基础知识。