图片旋转js代码

<script type="text/javascript">
//图片旋转js代码(2013-5-27)
        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;
            alert(deg2radians);
            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;
        }

    </script>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。