css3 動畫 旋轉(zhuǎn)移動

廢話不多說,直接上代碼
// css
.ellipse-rotate {
                width: 100px;
                height: 100px;
                position: absolute;
                -webkit-transition-property: -webkit-transform;
                -webkit-transition-duration: 1s;
                -moz-transition-property: -moz-transform;
                -moz-transition-duration: 1s;
                -webkit-animation: rotate 6s linear infinite;
                -moz-animation: rotate 6s linear infinite;
                animation: rotate 6s linear infinite;
                
            }
            .ellipse-move{
                -webkit-animation:move 10s infinite;
            animation: move 10s infinite;
                top: 80%;
                position: relative;
            }
            @-webkit-keyframes move {
                from {
                   top: 800px;
                }
                to {
                   top: 10px;
                }
            }
             @keyframes move {
                from {
                   top: 800px;
                }
                to {
                   top: 10px;
                }
            }
             @-moz-keyframes move {
                from {
                   top: 800px;
                }
                to {
                   top: 10px;
                }
            }
             @-o-keyframes move {
                from {
                   top: 800px;
                }
                to {
                   top: 10px;
                }
            }
            
            
            
            @-webkit-keyframes rotate {
                from {
                    -webkit-transform: rotate(0deg)
                }
                to {
                    -webkit-transform: rotate(360deg)
                }
            }
            
            @-moz-keyframes rotate {
                from {
                    -moz-transform: rotate(0deg)
                }
                to {
                    -moz-transform: rotate(359deg)
                }
            }
            
            @-o-keyframes rotate {
                from {
                    -o-transform: rotate(0deg)
                }
                to {
                    -o-transform: rotate(359deg)
                }
            }
            
            @keyframes rotate {
                from {
                    transform: rotate(0deg)
                }
                to {
                    transform: rotate(359deg)
                }
            }
            
            .horizontal {
                background-color: #f58f98;
                width: 100%;
                height: 50%;
                -moz-border-radius: 50%;
                -webkit-border-radius: 50%;
                border-radius: 50%;
                position: absolute;
                top: 25%;
            }
            
            .vertical {
                background-color: #f58f98;
                height: 100%;
                width: 50%;
                position: absolute;
                -moz-border-radius: 50%;
                -webkit-border-radius: 50%;
                border-radius: 50%;
                left: 25%;
            }
//html
<div class="ellipse-move">
            
            <div class="ellipse-rotate ">
                <div class=" horizontal">
    
                </div>
                <div class="vertical">
                </div>
            </div>
        </div>

原理也很簡單,主要把CSS3 的keyframes規(guī)則運(yùn)用靈活就行

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 179,045評論 25 709
  • CSS參考手冊 一、初識CSS3 1.1 CSS是什么 CSS3在CSS2.1的基礎(chǔ)上增加了很多強(qiáng)大的新功能。目前...
    沒汁帥閱讀 4,281評論 1 13
  • 年 就這樣 隆重而來 悄然而去 孩子們小花炮 豐富的年夜大餐 一家人聚集在一起 開心快樂 熱鬧非凡 一年又一年 感...
    糖寶寶閱讀 228評論 0 0
  • 我們每個(gè)人在現(xiàn)實(shí)生活中有二個(gè)身份,一個(gè)真我一個(gè)假我,線下的假我會 憤怒,生氣,評判等讓自己無喜悅和幸福感,向外求比...
    童鷺_閱讀 182評論 0 0
  • 這名女子叫艾切維利婭,現(xiàn)年63歲。她從11歲就開始使用強(qiáng)生的嬰兒爽身粉。當(dāng)?shù)孛襟w報(bào)道,艾切維利婭用爽身粉保持下體清...
    趣讀書吧閱讀 316評論 0 0

友情鏈接更多精彩內(nèi)容