CSS3 animation實(shí)現(xiàn)簡(jiǎn)易幻燈片輪播特效

CSS3有個(gè)別特性,可以觸發(fā)硬件GPU來加速渲染,而不是調(diào)用默認(rèn)瀏覽器引擎渲染;
但是很多屬性,默認(rèn)都是不開啟硬件加速的;需要觸發(fā)條件,一個(gè)最簡(jiǎn)單的觸發(fā)條件就是使用3D屬性(對(duì)Z軸的操作)
效果圖
代碼
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>CSS3幻燈片</title>
- <style type="text/css" media="screen">
- .items {
- width: 280px;
- height: 150px;
- border: 1px solid #ddd;
- box-sizing: border-box;
- border-radius:10px;
- background-size: cover;
- -webkit-transform: translateZ(0);
- transform: translateZ(0);
- background-repeat: no-repeat;
- -webkit-animation: slider 15s linear infinite alternate;
- animation: slider 15s linear infinite alternate;
- -webkit-transform-origin: center center;
- transform-origin: center center;
- }
- @-webkit-keyframes slider {
- 0% {
- background-image: url(1.jpg) ;
- }
- 25% {
- background-image: url(2.jpg) ;
- }
- 50% {
- background-image: url(3.jpg) ;
- }
- 75% {
- background-image: url(4.jpg);
- }
- 100% {
- background-image: url(5.jpg);
- }
- }
- @keyframes slider {
- 0% {
- background-image: url(1.jpg) ;
- }
- 25% {
- background-image: url(2.jpg) ;
- }
- 50% {
- background-image: url(3.jpg) ;
- }
- 75% {
- background-image: url(4.jpg);
- }
- 100% {
- background-image: url(5.jpg);
- }
- }
- </style>
- </head>
- <body>
- <div class="slider">
- <div class="items"></div>
- </div>
- </body>
- </html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
css3基于animation屬性實(shí)現(xiàn)的人物動(dòng)畫特效源碼
這是一款css3基于animation屬性實(shí)現(xiàn)的人物動(dòng)畫特效源碼。主要基于animation的background-position屬性實(shí)現(xiàn)的人物動(dòng)畫效果,沒有引入任何外部js元素2017-05-17CSS3中動(dòng)畫屬性transform、transition和animation屬性的區(qū)別
最近在項(xiàng)目中用到了CSS3中的動(dòng)畫屬性。無奈對(duì)于css3幾個(gè)新加的屬性不太熟悉,常常容易搞混。所以從網(wǎng)站研究了點(diǎn)資料,總結(jié)一下,方便有需要的朋友們可以參考學(xué)習(xí)。2016-09-25css3基于animation實(shí)現(xiàn)旋轉(zhuǎn)的摩天輪動(dòng)畫特效源碼
這是一款css3基于animation實(shí)現(xiàn)旋轉(zhuǎn)的摩天輪動(dòng)畫特效源碼,該特效實(shí)現(xiàn)了摩天輪順時(shí)針旋轉(zhuǎn)的動(dòng)畫效果,且動(dòng)畫過渡自然,流暢逼真。沒有使用任何JS元素2016-09-21- 這篇文章主要為大家詳細(xì)介紹了CSS3中Animation動(dòng)畫屬性用法,教大家如何使用animation動(dòng)畫,感興趣的小伙伴們可以參考一下2016-07-04
CSS3 animation實(shí)現(xiàn)逐幀動(dòng)畫效果
這篇文章主要介紹了CSS3 animation實(shí)現(xiàn)逐幀動(dòng)畫效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-06-02CSS3中的Transition過度與Animation動(dòng)畫屬性使用要點(diǎn)
這篇文章主要介紹了CSS3中的Transition過度與Animation動(dòng)畫屬性使用要點(diǎn)Transition和Animation能被用來制作基本的頁面圖片動(dòng)態(tài)效果,當(dāng)然進(jìn)一步的控制還是需要JavaScript的2016-05-20CSS3 Animation 制作動(dòng)畫點(diǎn)擊波效果代碼
CSS3 Animation 制作動(dòng)畫點(diǎn)擊波效果代碼是一款使用CSS3 animation動(dòng)畫來制作點(diǎn)擊波效果,可以在按鈕和圖片等元素上制作點(diǎn)擊波特效。需要的朋友前來下載源碼2016-05-04CSS3+Animation實(shí)現(xiàn)鼠標(biāo)滑過按鈕背景動(dòng)畫特效源碼
CSS3+Animation實(shí)現(xiàn)鼠標(biāo)滑過按鈕背景動(dòng)畫特效源碼是一款當(dāng)鼠標(biāo)滑過按鈕時(shí),使用CSS3 animation來動(dòng)畫background-size和background-position屬性,來制作各種背景動(dòng)畫效果。2016-04-19css3中用animation的steps屬性制作幀動(dòng)畫
這篇文章主要介紹了css中用animation的steps屬性制作幀動(dòng)畫,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-04-25