animation-direction屬性是用來定義是否應該輪流反向播放動畫的;當動畫播放次數超過一次時,我們就可以透過設定animation-direction的值為alternate來實現動畫輪流反向播放。
CSS3 animation-direction屬性
作用:定義是否應該輪流反向播放動畫。
語法:
animation-direction: normal|alternate;
normal:預設值。動畫應該可以正常播放。
alternate:動畫應該輪流反向播放。
說明: 如果animation-direction 值是"alternate",動畫會在奇數次數(1、3、5 等等)正常播放,而在偶數次數(2、4 、6 等等)向後播放。
註:如果把動畫設定為只播放一次,則該屬性沒有效果。
CSS3 animation-direction屬性的使用範例
<!DOCTYPE html> <html> <head> <style> div { width:100px; height:100px; background:red; position:relative; animation:myfirst 5s infinite; animation-direction:alternate; /* Safari and Chrome */ -webkit-animation:myfirst 5s infinite; -webkit-animation-direction:alternate; } @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;} } @-webkit-keyframes myfirst /* Safari and 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;} } </style> </head> <body> <div></div> </body> </html>
效果圖:
以上就是本篇文章的全部內容,希望能對大家的學習有所幫助。更多精彩內容大家可以追蹤php中文網相關教學欄位! ! !
以上是animation-direction屬性怎麼用的詳細內容。更多資訊請關注PHP中文網其他相關文章!

了解如何通過Chris Coyier實施WordPress的Gutenberg編輯器來創建一個自定義Codepen塊,並為Sanity Studio提供預覽。

格子呢是一塊圖案布,通常與蘇格蘭有關,尤其是他們時尚的蘇格蘭語。在Tartanify.com上,我們收集了5,000多個格子呢


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

Atom編輯器mac版下載
最受歡迎的的開源編輯器

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

禪工作室 13.0.1
強大的PHP整合開發環境

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

SublimeText3漢化版
中文版,非常好用