css3动画animation和loading动画

css3动画animation

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>动画</title>
		<style type="text/css">
			#donghua {
				width: 200px;
				height: 200px;
				background-color: #14569B;
				animation-name: donghua1;
				animation-duration: 2s;
				animation-timing-function: ease-in;
				animation-iteration-count: infinite;
				animation-direction: alternate;
				animation-delay: 3s;
                /* animation: donghua1 3s;综合性动画设置 */
				/* animation-name: 动画名称; */
				/* animation-duration: 2s; 动画周期时间*/
				/* animation-timing-function: 动画的变化速度; 默认ease, linear, ease-in,ease-out*/
				/* animation-iteration-count: 动画循环次数; infinite无限循环*/
				/* animation-direction: 运动方向 默认normal; alternate次数奇数正常,偶数反方向 ,reverse反方向*/
				/* animation-delay: 延迟时间; 只是第一次动画有效*/
				}
				@keyframes donghua1{
					/* from同等于0 */
					0{transform: translate(0,0);} 
					25%{transform: translate(500px,0);}
					50%{transform: translate(500px,500px);}
					75%{transform: translate(0,500px);}
					/* to同等于1 */
					1{transform: translate(0,0);}
				}
		</style>
	</head>
	<body>
		<div id="donghua">
			动画1
		</div>
	</body>
</html>

loading动画

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>loading</title>
		<style type="text/css">
			.loading {
				width: 500px;
				height: 500px;
				margin: 0 auto;
				position: relative;
			}
			.circle {
				width: 500px;
				height: 500px;
				position: absolute;
				top: 0;
				left: 0;
			}
			.small {
				width: 80px;
				height: 80px;
				background-color: skyblue;
				border-radius: 40px;
				margin: 0 auto;
			}
			.circle:nth-child(1) {
				transform: rotate(45deg);
				animation: loading 2s infinite;
			}
			.circle:nth-child(2) {
				transform: rotate(90deg);
				animation: loading 2s infinite;
				animation-delay: 0.15s;
			}
			.circle:nth-child(3) {
				transform: rotate(135deg);
				animation: loading 2s infinite;
				animation-delay: 0.5s;
			}
			.circle:nth-child(4) {
				transform: rotate(180deg);
				animation: loading 2s infinite;
				animation-delay: 0.75s;
			}
			.circle:nth-child(5) {
				transform: rotate(225deg);
				animation: loading 2s infinite;
				animation-delay: 1s;
			}
			.circle:nth-child(6) {
				transform: rotate(270deg);
				animation: loading 2s infinite;
				animation-delay: 1.25s;
			}
			.circle:nth-child(7) {
				transform: rotate(315deg);
				animation: loading 2s infinite;
				animation-delay: 1.5s;
			}
			.circle:nth-child(8) {
				transform: rotate(360deg);
				animation: loading 2s infinite;
				animation-delay: 1.75s;
			}
			
			@keyframes loading{
				from{opacity: 1;}
				to{opacity: 0.4;}
			}
			
		</style>
	</head>
	<body>
		<div class="loading">
			<div class="circle"><div class="small"></div></div>
			<div class="circle"><div class="small"></div></div>
			<div class="circle"><div class="small"></div></div>
			<div class="circle"><div class="small"></div></div>
			<div class="circle"><div class="small"></div></div>
			<div class="circle"><div class="small"></div></div>
			<div class="circle"><div class="small"></div></div>
			<div class="circle"><div class="small"></div></div>
		</div>
	</body>
</html>

loading

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值