zoukankan      html  css  js  c++  java
  • js控制图片旋转角度

    <html>
    <head>
    <title></title>
    <script type="text/javascript">
    function rotateImage() {
    imageToRotate = document.getElementById('imgRotate'); 
    imageToRotate.style.filter= "progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand')";
    window.setTimeout("rotate()",100);
    }
    var imageToRotate;
    var degreeToRotate=0;
    function rotate(){
    var deg2radians = Math.PI * 2 / 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;
    window.setTimeout("rotate()",100);
    }
    </script>
    </head>
    <body onload="rotateImage();">
    <br /> 
    <canvas id="canvas" width="800" height="600">
    <img id="imgRotate" src="http://www.baidu.com/img/logo-yy.gif" />
    </canvas>
    </body>
    </html>
  • 相关阅读:
    VMware虚拟机安装
    dmesg功能介绍
    Linux查看MAC地址方法
    linux介绍
    spring boot整合mybatis框架及增删改查(jsp视图)
    idea 热部署的配置
    idea注释类,方法
    idea2018破解
    BootStrap简单table
    解决bootstrap模态框居中问题
  • 原文地址:https://www.cnblogs.com/fanjiming/p/2248351.html
Copyright © 2011-2022 走看看