天天看點

圖檔旋轉js代碼 

function rotateimage(imgid) {

imagetorotate = document.getelementbyid(imgid);   

imagetorotate.style.filter= "progid:dximagetransform.microsoft.matrix(sizingmethod=‘auto expand‘)";

rotate();

}

var imagetorotate;

var degreetorotate=0;

function rotate(){

var deg2radians = math.pi * 180 / 360;

degreetorotate++;

degreetorotate=degreetorotate%360;   

rad = degreetorotate * deg2radians ;

costheta = math.cos(rad);

sintheta = math.sin(rad);

imagetorotate.filters.item(0).m11 = costheta;

imagetorotate.filters.item(0).m12 = -sintheta;

imagetorotate.filters.item(0).m21 = sintheta;

imagetorotate.filters.item(0).m22 = costheta;