1. js代碼怎麼讓一張圖片自動360度水平旋轉
<!DOCTYPEHTML>
<html>
<head>
<metacharset=UTF-8>
<title>YuGiOh</title>
<styletype="text/css">
#div{
position:absolute;
top:50px;
left:300px;
width:300px;
height:300px;
line-height:300px;
text-align:center;
border:1pxsolidblack;
}
</style>
<scripttype="text/javascript">
varrotateHTML5=function(limit)
{
varreg=/(rotate([-+]?((d+)(deg))))/i;
varwt=div.style['-webkit-transform'],wts=wt.match(reg);
var$2=RegExp.$2;
console.log($2);
div.style['-webkit-transform']=wt.replace($2,parseFloat(RegExp.$3)+limit+RegExp.$4);
}
varrotateIE=function(obj)
{
vard=!!obj.d?obj.d:1;
varr=d*Math.PI/180;
costheta=Math.cos(r);
sintheta=Math.sin(r);
obj.style.filter="progid:DXImageTransform.Microsoft.Matrix()";
varitem=obj.filters.item(0);
varwidth=obj.clientWidth;
varheight=obj.clientHeight;
item.DX=-width/2*costheta+height/2*sintheta+width/2;
item.DY=-width/2*sintheta-height/2*costheta+height/2;
item.M11=costheta;
item.M12=-sintheta;
item.M21=sintheta;
item.M22=costheta;
obj.timer=setTimeout(function()
{
vardx=d+1;
dx=dx>360?1:dx;
obj.d=dx;
rotate(obj,dx);
},30);
};
varstart=function()
{
if(!!div.interval)
{
clearInterval(div.interval);
deletediv.interval;
}
else
{
div.interval=setInterval(function()
{
/.*webkit.*/i.test(navigator.userAgent)?rotateHTML5(1):rotateIE(div);
},30);
}
}
</script>
</head>
<body>
<buttononclick="start();">rotate</button>
<divid="div"style="border-radius:90px;-webkit-transform:rotate(10deg);">ROTATE</div>
</body>
</html>
2. js實現圖片滾輪、按鈕縮放大小,圖片旋轉,圖片拖拽
<div class="upload-img-box" ref="moveWrap">
<div class="show-box" ref="rotate" @mousedown="moveImg" @mousewheel.prevent="rollImg($event,)">
<img :src="singleList.fileImgUrl" class="uploadimg" ref="img" :style="{transform:'scale('+multiples/100+') rotate('+rotate +'deg)'}"/>
</div>
<div class="img-plus" @click="toBIgChange()"><span class="tip">放大</span></div>
<div class="img-minus" @click="toSmallChange()"><span class="tip">縮小</span></div>
<div class="img-rotate" @click="toRotate()"><span class="tip">旋轉</span></div>
</div>
3. js設置圖片隨機旋轉角度
代碼應該是:
imgcss[i].style.transform="rotate(" + j + ")";
首先 j是變數 雙引號裡面套單引號 還是字元串, 不是變數
其次 字元串拼接要寫加號
4. javascript如何實現圖片任意角度的旋轉
可以用JAvascript改變這個圖片的css來旋轉他:
這個是css代碼:
img {
transform:rotate(7deg);
-ms-transform:rotate(7deg); /* IE 9 */
-moz-transform:rotate(7deg); /* Firefox */
-webkit-transform:rotate(7deg); /* Safari 和 Chrome */
-o-transform:rotate(7deg); /* Opera */
}
在JAvascript裡面可以先獲取到這張圖片 設置圖片id = "box"
var img = document.getElementById('box'); 獲取到這個圖片並用變數記住
img.style.transform = "rotate(90deg)"; 改變這個圖片的css,旋轉90度
完畢!!!
5. js 怎麼實現點擊一次圖片旋轉90度,再點擊再轉90度呢
現在我們以這個蘋果的圖片作為例子
6. js實現頁面的指定圖片在不停的旋轉,怎麼實現呢有代碼參考嗎謝謝
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
#div1 {
width: 800px;
height: 600px;
background-color: #ff0;
position: absolute;
}
.imgRotate {
width: 100px;
height: 80px;
position: absolute;
top: 50%;
left: 50%;
margin: -40px 0 0 -50px;
}
</style>
</head>
<body>
<div id="div1">
<img id="img1" class="imgRotate" src="http://www..com/img/logo-yy.gif" />
<input id="input2" type="button" value="btn2"></input>
</div>
</body>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jQueryRotate.js"></script>
<script type="text/javascript">
var num = 0;
$("#input2").click(function(){
num ++;
$("#img1").rotate(90*num);
});
</script>
</html>
7. 求教js實現圖片的旋轉
<!doctypehtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Test</title>
<script>
varcurrent=0;
functiontranImg(trun){
varimgObj=document.getElementById('imgTest');
current=(current+trun)%360;
imgObj.style.transform='rotate('+current+'deg)';
}
</script>
</head>
<body>
<imgid="imgTest"src="https://timgsa..com/timg?image&quality=80&size=b9999_10000&sec=1487259339574&di=&imgtype=0&src=http%3A%2F%2Fc.hiphotos..com%2Fimage%2Fpic%2Fitem%.jpg"target="_blank"class="-highlight">
<br>
<inputtype="button"id="leftTran"onclick="tranImg(-90)"value="左">
<inputtype="button"id="rightTran"onclick="tranImg(90)"value="右">
</body>
</html>
8. JS,圖片旋轉設定
SORRY 看錯內容了~ 這里有一個~ 你可以看下~網頁鏈接
9. javascript怎麼能旋轉圖片任意角度
文件---打開,找到你要編輯的圖片
打開以後呢,
再點
修改----變形---數字變形---下拉菜單選」旋轉」,輸入你想要的角度,保存就可以了..
但是這樣,圖片的突出部分會消失,如果你不想它消失的話,點
修改----畫布---符合畫布