<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        關于CSS3的animate如何實現“...”loading動畫效果(一)

        來源:懂視網 責編:小采 時間:2020-11-27 18:51:31
        文檔

        關于CSS3的animate如何實現“...”loading動畫效果(一)

        關于CSS3的animate如何實現...loading動畫效果(一):實現如圖所示的點點點loading效果:一:CSS3 animation實現代碼html代碼:提交訂單中<span class="ani_dot">...</span>css代碼:.ani_dot { font-family: simsun; } :root .ani_dot { /*
        推薦度:
        導讀關于CSS3的animate如何實現...loading動畫效果(一):實現如圖所示的點點點loading效果:一:CSS3 animation實現代碼html代碼:提交訂單中<span class="ani_dot">...</span>css代碼:.ani_dot { font-family: simsun; } :root .ani_dot { /*

        二:動畫(animation)的參數詳解

        由于上面用到了animation動畫,這里詳細介紹下這個animation的參數。

        簡介

        CSS動畫(Animations)簡單說就是在一段固定的動畫時間內暗中在某一頻率內改變其CSS某個或某些值,從而達到視覺上的轉換動畫效果。Animations的很多方面都是可以控制的,包括動畫運行時間,開始值和結束值,還有動畫的暫停和延遲其開始時間等。

        語法

        <single-animation> = <single-animation-name> || <time> || <single-animation-timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state>
        <' animation-name '>:檢索或設置對象所應用的動畫名稱<' animation-duration '>:檢索或設置對象動畫的持續時間<' animation-timing-function '>:檢索或設置對象動畫的過渡類型<' animation-delay '>:檢索或設置對象動畫延遲的時間<' animation-iteration-count '>:檢索或設置對象動畫的循環次數<' animation-direction '>:檢索或設置對象動畫在循環中是否反向運動<' animation-fill-mode '>:檢索或設置對象動畫時間之外的狀態<' animation-play-state '>:檢索或設置對象動畫的狀態。w3c正考慮是否將該屬性移除,因為動畫的狀態可以通過其它的方式實現,比如重設樣式

        animation

        所有動畫屬性的簡寫屬性,除了 animation-play-state 屬性。

        animation-name

        規定 @keyframes 動畫的名稱。就是@keyframes后面跟著的動畫名稱,本demo本文中名為dot,意思為“點”。

        animation-duration

        規定動畫完成一個周期所花費的秒或毫秒。默認是 0。

        animation-timing-function

        規定動畫的速度曲線。默認是 "ease"。

        常見的動畫速度參數:

        1. linear:線性過渡。等同于貝塞爾曲線(0.0, 0.0, 1.0, 1.0)

        2. ease:平滑過渡。等同于貝塞爾曲線(0.25, 0.1, 0.25, 1.0)

        3. ease-in:由慢到快。等同于貝塞爾曲線(0.42, 0, 1.0, 1.0)

        4. ease-out:由快到慢。等同于貝塞爾曲線(0, 0, 0.58, 1.0)

        5. ease-in-out:由慢到快再到慢。等同于貝塞爾曲線(0.42, 0, 0.58, 1.0)

        6. step-start:等同于 steps(1, start)

        7. step-end:等同于 steps(1, end)

        8. steps(<integer>[, [ start | end ]
          ]?):接受兩個參數的步進函數。第一個參數必須為正整數,指定函數的步數。第二個參數取值可以是start或end,指定每一步的值發生變化的時間點。第二個參數是可選的,默認值為end。

        9. cubic-bezier(<number>, <number>, <number>,
          <number>):特定的貝塞爾曲線類型,4個數值需在[0, 1]區間內

        animation-delay

        規定動畫何時開始。默認是 0。也即是指動畫延時執行時間。

        animation-iteration-count

        規定動畫被播放的次數。默認是 1。當然,我們可以設置2次,3次,依次遞推。還有個無線循環關鍵字infinite,也即是反復循環播放動畫。

        animation-direction

        規定動畫是否在下一周期逆向地播放。默認是 "normal"。當然還有下列值:

        1. reverse:反方向運行

        2. alternate:動畫先正常運行再反方向運行,并持續交替運行

        3. alternate-reverse:動畫先反運行再正方向運行,并持續交替運行

        animation-fill-mode

        規定對象動畫時間之外的狀態。

        1. none:默認值。不設置對象動畫之外的狀態

        2. forwards:設置對象狀態為動畫結束時的狀態

        3. backwards:設置對象狀態為動畫開始時的狀態

        4. both:設置對象狀態為動畫結束或開始的狀態,動畫開始之前是"from"或"0%"關鍵幀;動畫完成之后是"to"或"100%"關鍵幀狀態。

        animation-play-state

        規定動畫是否正在運行或暫停。默認是 "running"。還有個值paused:暫停。

        三:animation動畫實例

        實例一使用from to

        p{
         width:100px;
         height:100px;
         background:red;
         position:relative;
         animation:mymove 5s infinite;
         -moz-animation:mymove 5s infinite; /*Firefox*/
         -webkit-animation:mymove 5s infinite; /*Safari and Chrome*/
        }
        @keyframes mymove{
         from {left:0px;}
         to {left:200px;}
        }
        @-moz-keyframes mymove { /*Firefox*/
         from {left:0px;}
         to {left:200px;}
        }
        @-webkit-keyframes mymove{ /*Safari and Chrome*/
         from {left:0px;}
         to {left:200px;}
        }

        實例二使用百分比:

        @keyframes myfirst{
         0% {background: red; left:0px; top:0px;}
         25% {background: yellow; left:200px; top:0px;}
         50% {background: blue; left:200px; top:200px;}
         75% {background: green; left:0px; top:200px;}
         100% {background: red; left:0px; top:0px;}
        }
        
        @-moz-keyframes myfirst{ /* Firefox */
         0% {background: red; left:0px; top:0px;}
         25% {background: yellow; left:200px; top:0px;}
         50% {background: blue; left:200px; top:200px;}
         75% {background: green; left:0px; top:200px;}
         100% {background: red; left:0px; top:0px;}
        }
        
        @-webkit-keyframes myfirst{ /* Safari 和 Chrome */
         0% {background: red; left:0px; top:0px;}
         25% {background: yellow; left:200px; top:0px;}
         50% {background: blue; left:200px; top:200px;}
         75% {background: green; left:0px; top:200px;}
         100% {background: red; left:0px; top:0px;}
        }
        
        @-o-keyframes myfirst {/* Opera */
         0% {background: red; left:0px; top:0px;}
         25% {background: yellow; left:200px; top:0px;}
         50% {background: blue; left:200px; top:200px;}
         75% {background: green; left:0px; top:200px;}
         100% {background: red; left:0px; top:0px;}
        }

        實例三,利用js+Transform和Animation實現3D動畫

        只有webkit內核的瀏覽器才能看到相關3D動畫效果。
        實現效果如圖所示:

        css代碼:

        body {
         font-family: 'Lucida Grande', Verdana, Arial;
         font-size: 12px;
         }
        
         #stage {
         margin: 150px auto;
         width: 600px;
         height: 400px;
         -webkit-perspective: 800;
         }
        
         #rotate {
         margin: 0 auto;
         width: 600px;
         height: 400px;
         -webkit-transform-style: preserve-3d;
         -webkit-animation-name: x-spin;
         -webkit-animation-duration: 7s;
         -webkit-animation-iteration-count: infinite;
         -webkit-animation-timing-function: linear;
         }
        
         .ring {
         margin: 0 auto;
         height: 110px;
         width: 600px;
         -webkit-transform-style: preserve-3d;
         -webkit-animation-iteration-count: infinite;
         -webkit-animation-timing-function: linear;
         }
         
         .ring > :nth-child(odd) {
         background-color: #995C7F;
         }
        
         .ring > :nth-child(even) {
         background-color: #835A99;
         }
        
         .poster {
         position: absolute;
         left: 250px;
         width: 100px;
         height: 100px;
         opacity: 0.7;
         color: rgba(0,0,0,0.9);
         -webkit-border-radius: 10px;
         }
         
         .poster > p {
         font-family: 'Georgia', serif;
         font-size: 36px;
         font-weight: bold;
         text-align: center;
         margin-top: 28px;
         }
        
         #ring-1 {
         -webkit-animation-name: y-spin;
         -webkit-animation-duration: 5s;
         }
        
         #ring-2 {
         -webkit-animation-name: back-y-spin;
         -webkit-animation-duration: 4s;
         }
        
         #ring-3 {
         -webkit-animation-name: y-spin;
         -webkit-animation-duration: 3s;
         }
        
         @-webkit-keyframes x-spin {
         0% { -webkit-transform: rotateX(0deg); }
         50% { -webkit-transform: rotateX(180deg); }
         100% { -webkit-transform: rotateX(360deg); }
         }
        
         @-webkit-keyframes y-spin {
         0% { -webkit-transform: rotateY(0deg); }
         50% { -webkit-transform: rotateY(180deg); }
         100% { -webkit-transform: rotateY(360deg); }
         }
        
         @-webkit-keyframes back-y-spin {
         0% { -webkit-transform: rotateY(360deg); }
         50% { -webkit-transform: rotateY(180deg); }
         100% { -webkit-transform: rotateY(0deg); }
         }

        html代碼:

        <p id="stage">
         <p id="rotate">
         <p id="ring-1" class="ring"></p>
         <p id="ring-2" class="ring"></p>
         <p id="ring-3" class="ring"></p>
         </p>
        </p>

        js代碼:

        const POSTERS_PER_ROW = 12;
        const RING_RADIUS = 200;
        
        function setup_posters (row){
         var posterAngle = 360 / POSTERS_PER_ROW;
         for (var i = 0; i < POSTERS_PER_ROW; i ++) {
         var poster = document.createElement('p');
         poster.className = 'poster';
         
         var transform = 'rotateY(' + (posterAngle * i) + 'deg) translateZ(' + RING_RADIUS + 'px)';
         poster.style.webkitTransform = transform;
         
         var content = poster.appendChild(document.createElement('p'));
         content.textContent = i;
         row.appendChild(poster);
         }
        }
        
        function init (){
         setup_posters(document.getElementById('ring-1'));
         setup_posters(document.getElementById('ring-2'));
         setup_posters(document.getElementById('ring-3'));
        }
        
        window.addEventListener('load', init, false);

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        關于CSS3的animate如何實現“...”loading動畫效果(一)

        關于CSS3的animate如何實現...loading動畫效果(一):實現如圖所示的點點點loading效果:一:CSS3 animation實現代碼html代碼:提交訂單中<span class="ani_dot">...</span>css代碼:.ani_dot { font-family: simsun; } :root .ani_dot { /*
        推薦度:
        標簽: 動畫 lo css
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 国产精品亚洲片在线va| 国产午夜亚洲精品理论片不卡| 久久久久亚洲AV成人片| 久久青草国产免费观看| 亚洲最大天堂无码精品区| 37pao成人国产永久免费视频| 中文字幕亚洲色图| 美女视频黄.免费网址 | 亚洲AV无码专区亚洲AV桃| 国产va精品免费观看| 亚洲午夜无码久久| 热99re久久精品精品免费| 国产亚洲综合视频| 亚洲午夜精品第一区二区8050| 亚洲国产美女精品久久久久| 免费看片在线观看| 在线观看亚洲AV日韩A∨| 日本免费人成视频播放| 成人免费夜片在线观看| 亚洲午夜无码久久久久| 1000部夫妻午夜免费| 亚洲欧美成人综合久久久| 最近2022中文字幕免费视频| xxx毛茸茸的亚洲| 免费大香伊蕉在人线国产 | 视频一区二区三区免费观看| 亚洲精品尤物yw在线影院| 国产精品免费一区二区三区四区| 亚洲男人第一av网站| 在线免费一区二区| 一级免费黄色大片| 久久精品国产亚洲av影院| 免费黄网在线观看| 中文字幕版免费电影网站| 亚洲欧洲日产v特级毛片| 全黄性性激高免费视频| 色www永久免费网站| 一本色道久久综合亚洲精品蜜桃冫 | 久久亚洲国产精品五月天| 黄网址在线永久免费观看 | 亚洲综合伊人久久大杳蕉|