[ CSS ] animation

僅供快速參考,如果想詳細(xì)了解相關(guān)內(nèi)容,請(qǐng)參閱阮老師的博客 :
http://www.ruanyifeng.com/blog/2014/02/css_transition_and_animation.html

css關(guān)于動(dòng)畫(huà)和變換部分有3個(gè)詞很容易混淆,分別是transform(變換), translate(平移), transition(過(guò)渡)

其中transform和translate常見(jiàn)于如下形式:

.class
{
    transform: translate(826px);
}

而transition用于css3的動(dòng)畫(huà),表示過(guò)渡效果


1. transition


.class1
{
    transition: duration <delay> <property> <timing-function>, an other group;
}
.complete
{
    transition-property: height;
    transition-duration: 1s;
    transition-delay: 1s;
    transition-timing-function: ease;
}

2. animation


animation的寫(xiě)法

.class1
{
    animation: duration <delay> name <timing-function> <iteration-count> <fill-mode> <direction> <step(n)>;
    animation-play-state: play-state;
}
  1. duration: 1s
  2. delay: 1s
  3. name: name
  4. timing-function: linear | ease-in | ease-out | cubic-bezier
  5. iteration-count: 10 | infinite
  6. fill-mode: forwards | none | backwards | both
  7. direction: normal | alternate | reverse | alternate-reverse
  8. step(n): step(2) | step(10)
  9. play-state: running | paused

keyframe的寫(xiě)法

@keyframes rainbow
{
    0%
    { 
        background: #c00; 
    }
    50%
    { 
        background: orange; 
    }
    100%
    { 
        background: yellowgreen; 
    }
}
@keyframes rainbow
{
    from
    {
        background: #c00;
    }
    50%
    { 
        background: orange; 
    }
    to
    { 
        background: yellowgreen; 
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

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