This article describes the JS implementation button control picture 360-degree flip effect method. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
<TITLE>JS Implementation Button control picture 360 degree flip effect </title>
<body>
<script language= "JavaScript" >
var Isie = (Document.uniqueid)? 1:0;
var I=1;
function rotate (image)
{
var object = Image.parentnode;
if (Isie) {
Image.style.filter= "Progid:dXImagetransform.Microsoft.basicImage (rotation=" +i+ ")";
i++;
if (i>4) {i=1};
}
else{
try{
var canvas = document.createelement (' canvas ');
if (Canvas.getcontext ("2d")) {
Object.replacechild (Canvas,image);
var context = Canvas.getcontext ("2d");
Context.translate (176, 0);
Context.rotate (math.pi*0.5);
Context.drawimage (image,0,0);
}
}catch (e) {}
}
}
</script>
<input type= "button" value= "click Rotate Picture" onclick= "Rotate (document.getElementById (' myimg '))"/><br/>
</body>
I hope this article will help you with your JavaScript programming.