小編給大家分享一下css3怎么實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫(huà)效果,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!
實(shí)現(xiàn)css3中圖片的旋轉(zhuǎn)可以使用可以使用 -webkit-animation 和 @-webkit-keyframes 組合使用來(lái)完成。
-webkit-animation 是一個(gè)復(fù)合屬性,定義如下:
-webkit-animation: name duration timing-function delay iteration_count direction;
name: 是 @-webkit-keyframes 中需要指定的方法,用來(lái)執(zhí)行動(dòng)畫(huà)。
duration: 動(dòng)畫(huà)一個(gè)周期執(zhí)行的時(shí)長(zhǎng)。
timing-function: 動(dòng)畫(huà)執(zhí)行的效果,可以是線性的,也可以是"快速進(jìn)入慢速出來(lái)"等。
delay: 動(dòng)畫(huà)延時(shí)執(zhí)行的時(shí)長(zhǎng)。
iteration_count: 動(dòng)畫(huà)循環(huán)執(zhí)行次數(shù),如果是infinite,則無(wú)限執(zhí)行。
direction: 動(dòng)畫(huà)執(zhí)行方向。
@-webkit-keyframes 中的from和to 兩個(gè)屬性,就是指定動(dòng)畫(huà)執(zhí)行的初始值和結(jié)束值。
-webkit-animation-play-state:paused; 暫停動(dòng)畫(huà)的執(zhí)行。
在了解了css3實(shí)現(xiàn)圖片旋轉(zhuǎn)所用到的屬性值后,我們來(lái)直接看css3實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫(huà)的代碼:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>transform</title> <style> #loader { display: block; position: relative; -webkit-animation: spin 2s linear infinite; animation: spin 2s linear infinite; } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); -ms-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); -ms-transform: rotate(360deg); transform: rotate(360deg); } } @keyframes spin { 0% { -webkit-transform: rotate(0deg); -ms-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); -ms-transform: rotate(360deg); transform: rotate(360deg); } } </style> </head> <body> <div id="test" > <img src="http://img4.imgtn.bdimg.com/it/u=3413495237,2076545415&fm=26&gp=0.jpg" style="width:250px;height:250px" id="loader" /> </div> </body> </html>
看完了這篇文章,相信你對(duì)css3怎么實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫(huà)效果有了一定的了解,想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道,感謝各位的閱讀!
網(wǎng)頁(yè)題目:css3怎么實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫(huà)效果-創(chuàng)新互聯(lián)
鏈接分享:http://www.rwnh.cn/article22/djhscc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈、面包屑導(dǎo)航、服務(wù)器托管、ChatGPT、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容