CSS3 transition 屬性——逐漸變慢/勻速/加速/減速/加速然后減速


ease:

1、ease:(逐漸變慢)默認值


2、linear:(勻速)

3、ease-in:(加速)

4、ease-out:(減速)

5、ease-in-out:(加速然后減速)

6、cubic-bezier

如:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        *{margin:0; padding: 0;}
        .icon_down{ width: 0; height: 0; border-left:20px solid transparent; border-right: 20px solid transparent; border-top:20px solid #B03939; transition: all .1s ease-in 0ms; margin:50px auto; cursor: pointer; }
        .icon_down:hover{ transform: rotate(180deg);}
    </style>
</head>
<body>
    <div class="icon_down"></div>
</body>
</html>

效果圖:鼠標經過旋轉180度,

 

例子2:

把鼠標指針放到 div 元素上,其寬度會從 100px 逐漸變為 300px:

div
{
width:100px;
transition: width 2s;
-moz-transition: width 2s; /* Firefox 4 */
-webkit-transition: width 2s; /* Safari 和 Chrome */
-o-transition: width 2s; /* Opera */
}

效果圖:

鼠標經過后

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM