日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

html5网页动画总结--jQuery旋转插件jqueryrotate

發布時間:2024/4/17 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html5网页动画总结--jQuery旋转插件jqueryrotate 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

CSS3 提供了多種變形效果,比如矩陣變形、位移、縮放、旋轉和傾斜等等,讓頁面更加生動活潑有趣,不再一動不動。然后 IE10 以下版本的瀏覽器不支持 CSS3 變形,雖然 IE 有私有屬性濾鏡(filter),但不全面,而且效果和性能都不好。

今天介紹一款 jQuery 插件——jqueryrotate,它可以實現旋轉效果。jqueryrotate 支持所有主流瀏覽器,包括 IE6。如果你想在低版本的 IE 中實現旋轉效果,那么 jqueryrotate 是一個很好的選擇。
兼容性

jqueryrotate 支持所有主流瀏覽器,包括 IE6。jqueryrotate 在高級瀏覽器中使用 CSS3 transform 屬性實現,在低版本 IE 中使用 VML 實現。當然,你可以使用 IE 條件注釋,低版本 IE 使用 jqueryrotate,高級瀏覽器則直接使用 CSS3。

參數

參數類型說明默認值
angle數字旋轉一個角度0
animateTo數字從當前的角度旋轉到多少度0
step函數每個動畫步驟中執行的回調函數,當前角度值作為該函數的第一個參數
easing函數自定義旋轉速度、旋轉效果,需要使用 jQuery.easing.js
callback函數旋轉完成后的回調函數
getRotateAngle函數返回旋轉對象當前的角度
stopRotate函數停止旋轉

演示雖然使用的是圖片,但 jqueryrotate 并不只是能運用在圖片上,其他元素如 div 等也可以使用。同時,你可以發揮想象,制作出更多關于旋轉的特效。

代碼

<!doctype html> <html> <head> <meta charset="utf-8"> <title>jQuery旋轉插件jqueryrotate</title> <style> /** ease-in-out 規定以慢速開始和結束的過渡效果*/ img{ -moz-transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; -ms-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } img:hover{ -moz-transform: rotate(70deg); -webkit-transform: rotate(70deg); -o-transform: rotate(70deg); -ms-transform: rotate(70deg); transform: rotate(70deg); } body{background: url(images/bg.jpg) repeat center center;} .test {width: 500px;height: 300px;margin: 30px auto;position: relative;} .test img {position: absolute;top: 40%;left: 0%;margin-left: -70px;margin-top: -100px; } .test img:nth-child(1){z-index:;opacity: .6; } .test img:nth-child(2){z-index: 2; transform: rotate(45deg); }</style><script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.rotate.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ //旋轉45度 $('#img1').rotate({angle:45});//鼠標滑過旋轉180,離開回0度 $("#img2").rotate({ bind: { mouseover : function() { $(this).rotate({animateTo:180});},mouseout : function() { $(this).rotate({animateTo:0});}} });//慢速旋轉 var angle = 0; setInterval(function(){angle+=3;$("#img3").rotate(angle); },50);//快速旋轉一周,callback回調有時間間隔 var rotation = function (){$("#img4").rotate({angle:0, animateTo:360, callback: rotation}); } rotation();//這個沒搞明白怎么用 var rotation2 = function (){$("#img5").rotate({angle:0, animateTo:360, callback: rotation2,easing: function (x,t,b,c,d){ // t: current time, b: begInnIng value, c: change In value, d: durationreturn c*(t/d)+b; }}); } rotation2();//點擊后旋轉180度 $("#img6").rotate({ bind: { click: function(){$(this).rotate({ angle:0,animateTo:180,easing: $.easing.easeInOutExpo })}} });//每次點擊在原基礎上旋轉90度 var value2 = 0 $("#img7").rotate({ bind: {click: function(){value2 +=90;$(this).rotate({ animateTo:value2})}} });//蹺蹺板動畫 var nnn = 0; setInterval(function(){nnn++;if(nnn>=20){ $("#img8").rotate(45);}if(nnn>=50){ $("#img8").rotate(0);nnn=0;} },50);}); </script></head><body> <img id="img1" src="images/chrome.png" width="256" height="256"/> <img id="img2" src="images/chrome.png" width="256" height="256" /> <img id="img3" src="images/chrome.png" width="256" height="256"/> <img id="img4" src="images/chrome.png" width="256" height="256"/> <br> <img id="img5" src="images/chrome.png" width="256" height="256"/> <img id="img6" src="images/chrome.png" width="256" height="256"/> <img id="img7" src="images/chrome.png" width="256" height="256"/> <img id="img8" src="images/chrome.png" width="256" height="256"/> <br>鼠標滑過后旋轉,離開后恢復原位: <div class="test"> <img src="images/cardKingClub.png" alt="" width="70" height="100" /> <a herf="#"><img src="images/cardKingClub.png" alt="" width="70" height="100" /></a> </div> <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">html5網頁動畫總結--jQuery旋轉插件jqueryrotate</div></body> </html>

?

總結

以上是生活随笔為你收集整理的html5网页动画总结--jQuery旋转插件jqueryrotate的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。