久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      利用CSS3創(chuàng)建實用的加載動畫效果(兩種)

      在之前的文章《利用CSS3創(chuàng)建炫酷的三角背景圖像》中,我們介紹了使用CSS3創(chuàng)建炫酷的三角背景的方法。這次我們繼續(xù)CSS3效果分享,看看利用利用純CSS3如何實現(xiàn)加載動畫效果,感興趣的可以學(xué)習(xí)了解一下~

      在進(jìn)入網(wǎng)站時,因為需要顯示許多圖片,往往需要加載一段時間。如果這里添加一個動態(tài)的加載效果,這樣就不會讓等待變得枯燥。例如下圖這樣:

      利用CSS3創(chuàng)建實用的加載動畫效果(兩種)

      本篇文章就來給大家分享兩種使用CSS3實現(xiàn)的加載動畫效果。這兩種方法都是利用animation和@keyframes來實現(xiàn),下面我們來看看實現(xiàn)代碼:

      第一種效果的實現(xiàn)方法:

      <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8"> 		<style type="text/css"> 			html, 			body { 				padding: 0; 				height: 100%; 				display: table; 				margin: 0 auto; 				font-size: 52px; 				font-family: Monaco, Consolas, "Lucida Console", monospace; 				background-image: url("http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/kindajean.png"); 			}  			.loading { 				text-align: center; 				display: table-cell; 				vertical-align: middle; 				text-shadow: grey 1px 1px 1px; 			}  			.letter { 				float: left; 				width: 35px; 				height: 60px; 				position: relative; 				-webkit-animation: flip 2s infinite; 				-webkit-transform-style: preserve-3d; 				-webkit-transition: -webkit-transform 1s; 			}  			.letter div { 				width: 100%; 				height: 100%; 				position: absolute; 				-webkit-transform: translate(0); 				-webkit-backface-visibility: hidden; 				-webkit-animation: color 8s infinite; 			}  			.letter div.back { 				-webkit-transform: rotateY(180deg); 			}  			.letter:nth-child(1), 			.letter:nth-child(1) div { 				-webkit-animation-delay: 0.125s; 			}  			.letter:nth-child(2), 			.letter:nth-child(2) div { 				-webkit-animation-delay: 0.25s; 			}  			.letter:nth-child(3), 			.letter:nth-child(3) div { 				-webkit-animation-delay: 0.375s; 			}  			.letter:nth-child(4), 			.letter:nth-child(4) div { 				-webkit-animation-delay: 0.5s; 			}  			.letter:nth-child(5), 			.letter:nth-child(5) div { 				-webkit-animation-delay: 0.625s; 			}  			.letter:nth-child(6), 			.letter:nth-child(6) div { 				-webkit-animation-delay: 0.75s; 			}  			.letter:nth-child(7), 			.letter:nth-child(7) div { 				-webkit-animation-delay: 0.875s; 			}  			.letter:nth-child(8), 			.letter:nth-child(8) div { 				-webkit-animation-delay: 1s; 			}  			.letter:nth-child(9), 			.letter:nth-child(9) div { 				-webkit-animation-delay: 1.125s; 			}  			.letter:nth-child(10), 			.letter:nth-child(10) div { 				-webkit-animation-delay: 1.25s; 			}  			@-webkit-keyframes flip { 				0% { 					-webkit-transform: rotateY(0deg) translate(0); 				}  				40%, 				100% { 					-webkit-transform: rotateY(180deg) translate(0); 				} 			}  			@-webkit-keyframes color { 				0% { 					color: #88E488; 				}  				25% { 					color: #EEADB7; 				}  				50% { 					color: #90C9DB; 				}  				75% { 					color: #F3B034; 				}  				100% { 					color: #828282; 				} 			} 		</style> 	</head> 		<body> 			<div class="loading"> 				<div class="letter"> 					<div>L</div> 					<div class="back">L</div> 				</div> 				<div class="letter"> 					<div>o</div> 					<div class="back">o</div> 				</div> 				<div class="letter"> 					<div>a</div> 					<div class="back">a</div> 				</div> 				<div class="letter"> 					<div>d</div> 					<div class="back">d</div> 				</div> 				<div class="letter"> 					<div>i</div> 					<div class="back">i</div> 				</div> 				<div class="letter"> 					<div>n</div> 					<div class="back">n</div> 				</div> 				<div class="letter"> 					<div>g</div> 					<div class="back">g</div> 				</div> 				<div class="letter dot"> 					<div>.</div> 					<div class="back">.</div> 				</div> 				<div class="letter dot"> 					<div>.</div> 					<div class="back">.</div> 				</div> 				<div class="letter dot"> 					<div>.</div> 					<div class="back">.</div> 				</div> 			</div> 		</body> </html>
      • 在上面代碼中,先使用兩個animation屬性給每個字綁定兩種動畫flip和color,分別控制翻轉(zhuǎn)動作和顏色變化;然后分別利用@keyframes規(guī)則,給兩個動畫設(shè)置每一幀的動作即可。

      • 翻轉(zhuǎn)動作需要使用transform屬性來控制,它可以向元素應(yīng)用 2D 或 3D 轉(zhuǎn)換。

      效果如下:

      利用CSS3創(chuàng)建實用的加載動畫效果(兩種)

      下面的效果也是同一種實現(xiàn)思想,只是在細(xì)微處有點改變。

      第二種效果的實現(xiàn)方法:

      <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8"> 		<style> 			html, 			body { 				padding: 0; 				height: 100%; 				display: table; 				margin: 0 auto; 				font-size: 52px; 				font-family: Monaco, Consolas, "Lucida Console", monospace; 				background: #F5F5F5; 			}  			.loading { 				top: 50%; 				left: 50%; 				width: 350px; 				height: 60px; 				font-size: 52px; 				position: absolute; 				text-align: center; 				margin-top: -30px; 				margin-left: -175px; 				text-shadow: #808080 1px 1px 1px; 				font-family: Monaco, Consolas, "Lucida Console", monospace; 			}  			.letter { 				float: left; 				width: 35px; 				height: 60px; 				position: relative; 				animation: flip 2s infinite; 				transform-style: preserve-3d; 				transition: transform 1s; 			}  			.letter div { 				color: #4B6; 				width: 100%; 				height: 100%; 				position: absolute; 				transform: translate(0); 				backface-visibility: hidden; 				animation: color 16s infinite; 			}  			.letter div.back { 				transform: rotateY(180deg); 			}  			.letter:nth-child(1), 			.letter:nth-child(1) div { 				animation-delay: 0.125s; 			}  			.letter:nth-child(2), 			.letter:nth-child(2) div { 				animation-delay: 0.25s; 			}  			.letter:nth-child(3), 			.letter:nth-child(3) div { 				animation-delay: 0.375s; 			}  			.letter:nth-child(4), 			.letter:nth-child(4) div { 				animation-delay: 0.5s; 			}  			.letter:nth-child(5), 			.letter:nth-child(5) div { 				animation-delay: 0.625s; 			}  			.letter:nth-child(6), 			.letter:nth-child(6) div { 				animation-delay: 0.75s; 			}  			.letter:nth-child(7), 			.letter:nth-child(7) div { 				animation-delay: 0.875s; 			}  			.letter:nth-child(8), 			.letter:nth-child(8) div { 				animation-delay: 1s; 			}  			.letter:nth-child(9), 			.letter:nth-child(9) div { 				animation-delay: 1.125s; 			}  			.letter:nth-child(10), 			.letter:nth-child(10) div { 				animation-delay: 1.25s; 			}  			@keyframes flip { 				0% { 					transform: rotateY(0deg) translate(0); 				}  				40%, 				100% { 					transform: rotateY(180deg) translate(0); 				} 			}  			@keyframes color { 				1.5% { 					color: #6AD; 				}  				3%, 				12.5% { 					color: #F80; 				}  				14% { 					color: #4B6; 				}  				15.5%, 				25% { 					color: #F68; 				}  				26.5% { 					color: #C83; 				}  				28%, 				37.5% { 					color: #96C; 				}  				39% { 					color: #C83; 				}  				40.5%, 				50% { 					color: #E44; 				}  				51.5% { 					color: #F80; 				}  				53%, 				62.5% { 					color: #4B6; 				}  				64% { 					color: #F68; 				}  				65.5%, 				75% { 					color: #C83; 				}  				76.5% { 					color: #96C; 				}  				78%, 				87.5% { 					color: #6AD; 				}  				89% { 					color: #F80; 				}  				90.5%, 				100%, 				0% { 					color: #4B6; 				} 			} 		</style> 	</head> 	<body> 		<div class="loader"> 			<div class="loading"> 				<div class="letter"> 					<div>L</div> 					<div class="back">L</div> 				</div> 				<div class="letter"> 					<div>o</div> 					<div class="back">o</div> 				</div> 				<div class="letter"> 					<div>a</div> 					<div class="back">a</div> 				</div> 				<div class="letter"> 					<div>d</div> 					<div class="back">d</div> 				</div> 				<div class="letter"> 					<div>i</div> 					<div class="back">i</div> 				</div> 				<div class="letter"> 					<div>n</div> 					<div class="back">n</div> 				</div> 				<div class="letter"> 					<div>g</div> 					<div class="back">g</div> 				</div> 				<div class="letter"> 					<div>.</div> 					<div class="back">.</div> 				</div> 				<div class="letter"> 					<div>.</div> 					<div class="back">.</div> 				</div> 				<div class="letter"> 					<div>.</div> 					<div class="back">.</div> 				</div> 			</div> 		</div> 	</body> </html>

      效果如下:

      利用CSS3創(chuàng)建實用的加載動畫效果(兩種)

      下面介紹3個關(guān)鍵屬性animation、@keyframes和transform:

      • CSS3 animation(動畫) 屬性

      語法:animation: name duration timing-function delay iteration-count direction fill-mode play-state;

      animation-name:指定要綁定到選擇器的關(guān)鍵幀的名稱 animation-duration:動畫指定需要多少秒或毫秒完成 animation-timing-function:設(shè)置動畫將如何完成一個周期 animation-delay:設(shè)置動畫在啟動前的延遲間隔。 animation-iteration-count:定義動畫的播放次數(shù)。 animation-direction:指定是否應(yīng)該輪流反向播放動畫。 animation-fill-mode:規(guī)定當(dāng)動畫不播放時(當(dāng)動畫完成時,或當(dāng)動畫有一個延遲未開始播放時),要應(yīng)用到元素的樣式。 animation-play-state:指定動畫是否正在運行或已暫停。
      • @keyframes 規(guī)則

      使用@keyframes規(guī)則可以創(chuàng)建動畫。創(chuàng)建動畫是通過逐步改變從一個CSS樣式設(shè)定到另一個。簡單來說:@keyframes就是用來設(shè)置動畫每一幀動作的。

      @keyframes需要和animation 屬性一起使用才能實現(xiàn)動畫:

      @keyframe規(guī)則由關(guān)鍵字“@keyframe”組成,后面接著是給出動畫名稱的標(biāo)識符(將使用animation-name引用),隨后是通過一組樣式規(guī)則(用大括號分隔)。然后,通過使用標(biāo)識符作為animation-name屬性的值,將動畫應(yīng)用于元素。例如:

      /* 定義動畫*/ @keyframes 動畫名稱{     /* 樣式規(guī)則*/ }  /* 將它應(yīng)用于元素 */ .element {     animation-name: 動畫名稱(在@keyframes中已經(jīng)聲明好的);      /* 或使用動畫簡寫屬性*/     animation: 動畫名稱 1s ... }
      • CSS3 transform 屬性

      transform 屬性向元素應(yīng)用 2D 或 3D 轉(zhuǎn)換。該屬性允許我們對元素進(jìn)行旋轉(zhuǎn)、縮放、移動或傾斜。

      語法:transform: none|transform-functions;

      none	定義不進(jìn)行轉(zhuǎn)換。 matrix(n,n,n,n,n,n)	定義 2D 轉(zhuǎn)換,使用六個值的矩陣。 matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n)	定義 3D 轉(zhuǎn)換,使用 16 個值的 4x4 矩陣。	 translate(x,y)	定義 2D 轉(zhuǎn)換。 translate3d(x,y,z)	定義 3D 轉(zhuǎn)換。	 translateX(x)	定義轉(zhuǎn)換,只是用 X 軸的值。 translateY(y)	定義轉(zhuǎn)換,只是用 Y 軸的值。 translateZ(z)	定義 3D 轉(zhuǎn)換,只是用 Z 軸的值。	 scale(x,y)	定義 2D 縮放轉(zhuǎn)換。 scale3d(x,y,z)	定義 3D 縮放轉(zhuǎn)換。	 scaleX(x)	通過設(shè)置 X 軸的值來定義縮放轉(zhuǎn)換。 scaleY(y)	通過設(shè)置 Y 軸的值來定義縮放轉(zhuǎn)換。 scaleZ(z)	通過設(shè)置 Z 軸的值來定義 3D 縮放轉(zhuǎn)換。	 rotate(angle)	定義 2D 旋轉(zhuǎn),在參數(shù)中規(guī)定角度。 rotate3d(x,y,z,angle)	定義 3D 旋轉(zhuǎn)。	 rotateX(angle)	定義沿著 X 軸的 3D 旋轉(zhuǎn)。 rotateY(angle)	定義沿著 Y 軸的 3D 旋轉(zhuǎn)。 rotateZ(angle)	定義沿著 Z 軸的 3D 旋轉(zhuǎn)。 skew(x-angle,y-angle)	定義沿著 X 和 Y 軸的 2D 傾斜轉(zhuǎn)換。 skewX(angle)	定義沿著 X 軸的 2D 傾斜轉(zhuǎn)換。 skewY(angle)	定義沿著 Y 軸的 2D 傾斜轉(zhuǎn)換。 perspective(n)	為 3D 轉(zhuǎn)換元素定義透視視圖。

      PHP中文網(wǎng)平臺有非常多的視頻教學(xué)資源,歡迎大家學(xué)習(xí)《css視頻教程》!

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號