日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > CSS >内容正文

CSS

CSS3学习之 animation 属性

發布時間:2024/8/24 CSS 51 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CSS3学习之 animation 属性 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

? ? 發現animation這個新屬性很有趣,在此學習,并整理下!

? ??瀏覽器支持

? ? ? ?Internet Explorer 10、Firefox 以及 Opera 支持 animation 屬性;

? ? ? ?Safari 和 Chrome 支持替代的 -webkit-animation 屬性。

? ??定義和用法

? ? animation 屬性是一個簡寫屬性,用于設置六個動畫屬性:

  • animation-name
  • animation-duration
  • animation-timing-function
  • animation-delay
  • animation-iteration-count
  • animation-direction

? ???語法

animation: name duration timing-function delay iteration-count direction; 值描述
animation-name規定需要綁定到選擇器的 keyframe 名稱。。 animation-name: keyframename|none;
animation-duration

規定完成動畫所花費的時間,以秒或毫秒計。

animation-duration: time;
animation-timing-function規定動畫的速度曲線。 animation-timing-function: value;
animation-delay

規定在動畫開始之前的延遲。

animation-delay: time;
animation-iteration-count規定動畫應該播放的次數。 animation-iteration-count: n|infinite(無限次);
animation-direction規定是否應該輪流反向播放動畫。 animation-direction: normal(正常)|alternate(輪流反向播放);

?

?

?

?

?

?

?

?

?

?

?

?

?

?

其中

animation-timing-function 使用名為三次貝塞爾(Cubic Bezier)函數的數學函數,來生成速度曲線。您能夠在該函數中使用自己的值,也可以預定義的值:

值描述
linear動畫從頭到尾的速度是相同的。
ease默認。動畫以低速開始,然后加快,在結束前變慢。
ease-in動畫以低速開始。
ease-out動畫以低速結束。
ease-in-out動畫以低速開始和結束。
cubic-bezier(n,n,n,n)在 cubic-bezier 函數中自己的值。可能的值是從 0 到 1 的數值。

?

?

?

?

?

?

?

案例:

很實際的,一個箭頭循環上下跳動

#auto{

-webkit-animation:dd 1s infinite;
animation:dd 1s infinite;

}

@keyframes dd{
0% {transform:translate(0, 10px)}
50% {transform:translate(0, 0)}
100% {transform:translate(0, 10px)}
}
@-webkit-keyframes dd{
0% {-webkit-transform:translate(0, 10px)}
50% {-webkit-transform:translate(0, 0)}
100% {-webkit-transform:translate(0, 10px)}
}

?

注釋:animation?這個屬性的使用必須結合@keyframes一起使用

百分比的意思就是duration的百分比,如果沒有設置duration的話,則表示為無窮大。

transform:translate():含義--變動,位移;也是CSS3里面的新屬性。

轉載于:https://www.cnblogs.com/Gwen-hui/p/4371915.html

總結

以上是生活随笔為你收集整理的CSS3学习之 animation 属性的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。