本章介紹css3-動畫(animation)效果的實現,讓大家了解一個簡單的css3動畫是如何實現的。有一定的參考價值,有需要的朋友可以參考一下,希望對你有幫助。
css3-動畫(animation):
#具有下列屬性:
1、animation-name 自訂動畫名稱
2、animation-duration 動畫指定需要多少秒或毫秒完成,預設值是0;
3、animation-timing-function 動畫的時間曲線,linear 勻速, ease 先慢後快,結束前變慢。
4、animation-delay 動畫在啟動前的延遲間隔,預設是0
5、animation-iteration-count 動畫的播放次數,預設是1
6、animation-direction 是否輪流反向播放動畫
7、animation-play-state 動畫是否正在運作或已暫停。值:paused 指定暫停動畫 ; running 指定正在運行的動畫,預設。
程式碼實例(以平移--translate為例說明動畫的整個過程):
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .warp { height: 100px; width: 100px; border: 1px solid #eee; background-color: #21B4BB; animation-name: moves; animation-direction: alternate; animation-delay: 0.2s; animation-duration: 5s; animation-play-state: paused; animation-iteration-count: 3; /*以上可以简写成:*/ animation: moves 5s linear 0.2s 3; } @keyframes moves { /*动画名称自定义*/ 10% { background-color: #21B4BB; /*时间点可以任意,10%表示当时间进行到10%是元素要达到的状态*/ transform: translate(100px, 0); -ms-transform: translate(100px, 0); /*IE 9*/ -moz-transform: translate(100px, 0); /* Firefox */ -webkit-transform: translate(100px, 0); /* Safari 和 Chrome */ -o-transform: translate(100px, 0); /* Opera */ } 30% { background-color: #008000; /*时间点可以任意*/ transform: translate(100px, 100px); -ms-transform: translate(100px, 100px); /*IE 9*/ -moz-transform: translate(100px, 100px); /* Firefox */ -webkit-transform: translate(100px, 100px); /* Safari 和 Chrome */ -o-transform: translate(100px, 100px); /* Opera */ } 60% { background-color: #444444; /*时间点可以任意*/ transform: translate(0, 100px); -ms-transform: translate(0, 100px); /*IE 9*/ -moz-transform: translate(0, 100px); /* Firefox */ -webkit-transform: translate(0, 100px); /* Safari 和 Chrome */ -o-transform: translate(0, 100px); /* Opera */ } 100% { background-color: #70DBDB; /*时间点可以任意*/ transform: translate(0, 0); -ms-transform: translate(0, 0); /*IE 9*/ -moz-transform: translate(0, 0); /* Firefox */ -webkit-transform: translate(0, 0); /* Safari 和 Chrome */ -o-transform: translate(0, 0); /* Opera */ } } </style> </head> <body> <div class="warp"> </div> </body> </html>
效果圖:
以上是css3-動畫(animation)效果的實現的詳細內容。更多資訊請關注PHP中文網其他相關文章!

當他們在2013年去Chrome時,我們失去了歌劇。與Edge今年早些時候也進行了同樣的交易。邁克·泰勒(Mike Taylor)稱這些變化為“減少

在本週的綜述中,Apple進入Web組件,Instagram如何插入腳本以及一些思考的食物,以進行自託管關鍵資源。


熱AI工具

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

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

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

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

SublimeText3 Linux新版
SublimeText3 Linux最新版

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

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器